Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we color boxes differently? #45

Open
bast opened this issue Nov 1, 2020 · 17 comments
Open

Can we color boxes differently? #45

bast opened this issue Nov 1, 2020 · 17 comments

Comments

@bast
Copy link
Member

bast commented Nov 1, 2020

Now: "challenge" and "discussion" and "callout" and ... are all blue.

@rkdarst
Copy link
Member

rkdarst commented Nov 1, 2020

I really agree and would like to, but wasn't confident enough to come up with a color scheme myself. But it will be easy to add it, if someone can find some good colors. (prototype is already in the css file, we just need the colors: sphinx_lesson/_static/sphinx_lesson.css, see bottom and copy instructor-note example for other classes).

@rkdarst
Copy link
Member

rkdarst commented Nov 1, 2020 via email

@mehimself
Copy link
Contributor

Here is adobe's gadget to pick balanced colors: https://color.adobe.com/create/color-wheel

you can even extract a color theme from images (screenshots?)

@robertodr
Copy link
Contributor

See also ColorBrewer: https://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3

@rkdarst
Copy link
Member

rkdarst commented Dec 3, 2020

For this, my general thought is:

  • sphinx-rtd-theme provides ~4 colors by default (blue, green, red, orange) which seems like a good number
  • think of which sphinx-lesson box should map to each of those colors (by simple css class specification)
  • so that we do the least amount of special casing, and are most compatible with any theme. If this is useful, I don't know, but seems like a good principle...

@robertodr
Copy link
Contributor

I'm playing around a bit with this while preparing a lesson. I'm also adding some directives which might be generally useful. I'll keep you posted and maybe I can contribute a PR with these changes.

At the moment, sphinx-lesson does not play very well with other themes. It kind of works with sphinx-book-theme, but gives hideous results with pydata-sphinx-theme.

@rkdarst
Copy link
Member

rkdarst commented Dec 3, 2020 via email

@rkdarst
Copy link
Member

rkdarst commented Dec 3, 2020 via email

@bast
Copy link
Member Author

bast commented Dec 3, 2020

I would like to limit the number of directives to what "we" need. To not suffer from YAGNI and carrying the legacy backwards compatibility backpack.

But a broader discussion on this is useful.

@rkdarst
Copy link
Member

rkdarst commented Dec 6, 2020

By the way, when picking colors, I also run it through some web accessibility checker to make sure the colors are OK (AA level). I think this is what I used before: https://wave.webaim.org/

@bast
Copy link
Member Author

bast commented Mar 27, 2021

I am also adapting this for my new lesson. I think we should:

  • provide a basic set which is not all blue
  • document how to override it (it's easy once you know how/where)
  • reduce the number of directives
  • document how you can add more directives locally

@rkdarst
Copy link
Member

rkdarst commented Mar 28, 2021

I agree. And I think now we have enough different use cases that we can think about this. Can everyone interested give your thoughts on what principles to use, and what directives you suggest?

Built-in directives (ReST/Sphinx) include:

  • ReST/docutils: important, attention, hint, caution, tip, warning, danger, error.
  • Sphinx: note, warning, seealso, (versionadded, versionchanged, deprecated)

At reast sphinx_rtd_theme has four default colors, but I think I have seen a similar system in other themes but it is my no means guaranteed. I think the more compatibility we keep with other themes, the better (even if it doesn't work yet). Perhaps an easy way to do this is to try to inherit from these roles, rather than define our own new colors, as much as possible:

  • blue (most things)
  • green (important, hint, tip)
  • yellowish (warning, attention, caution)
  • red (danger, error).

So, please comment!

@rkdarst
Copy link
Member

rkdarst commented Mar 28, 2021

And for reference carpentries blocks:

  • code: error, warning, output, source
  • admonitions: callout, caution, challenge, checklist, discussion, keypoints, objectives, prereq, solution, testimonial

@robertodr
Copy link
Contributor

For our (ENCCS) purposes we've added (see here https://github.com/ENCCS/cmake-workshop/blob/main/content/custom.py):

  1. signature (green with wrench emoji, toggle-shown, dropdown) for function signatures
  2. parameters (green with laptop emoji, dropdown) for function parameters
  3. typealong (grey with keyboard emoji, toggle-shown, dropdown) for exercises where the instructor types and shares their screen.

@bast
Copy link
Member Author

bast commented Apr 1, 2021

  • Please not prereq. It is inconsistent with all the rest. If, then prerequisites.
  • callout do we need it? What is it? I only learned this word from Carpentries lesson template.
  • Let us add: instructor-notes (but I guess it is there?)

@rkdarst
Copy link
Member

rkdarst commented Apr 5, 2021

Here is my proposal:

We have three base colors (blue, green, yellow, red). green/red is bad for color preception purposes, also "red" seems rather extreme and thus I don't use it often.

Blue: admonition (general class), most everything by default gets this.

  • objectives, keypoints, quesitons (if still used). These are some of the few I actually use, but I am wondering if they should be eliminated. At least, these are the only ones I sometimes use.
  • advanced (new). drop-down, hidden by default.

Green: "Take an action", derived from "important". This is everything which a person should do. This includes "Exercise" and "Homework".

  • type-along (new)
  • exercise (new)
  • homework (new)
  • solution (while technically not a "do this", maybe it's best to make it match? otherwise blue)
  • Note that exercises/type-alongs can be long, perhaps a whole section/episode. I propose a convention of only tag the starting point in this case, not the whole thing (where making everything green has no purpose).

Yellow: "Important". Important things to remember. No new directives here, warning is sufficient for now.

  • warning (base Sphinx directive, nothing new here)

Red: "Danger", nothing new here

  • danger (base Sphinx directive), not used often.

Grey: "Not important, don't read" (as we have now)

  • instructor-note (already exists)

Primarily we distinguish between the types of boxes by the emojis, which could be improved.

As for general extendability, anything can be done with a basic admonition directive. For example, prerequisites can be (as defined by sphinx-lesson):

.. prerequisites::

   Content

Or (using nothing but base ReST):

.. admonition:: Prerequisites

   Content

One difference in regular ReST is that "admonition" accepts a title, but other directives don't. I made all of our custom directives accept a title, but if it's not given, then it has some default one (usually the same as the directive). I think this is a useful default, but may have some issues with confusion because it's non-standard!

@rkdarst
Copy link
Member

rkdarst commented Apr 5, 2021

@bast re: callout: "callout" was just from carpentries template when I copied everything. I guess we should leave some aliases (even if not documented) for purposes of conversion.

I think they have a different philosophy where learners don't really see things and almost everything is type-along by default, so the concept of exercise or type-along isn't so relevant to them, thus the difficulty in adapting their default to us. Perhaps I should check again to see what they have...

rkdarst added a commit that referenced this issue Apr 15, 2021
- Standardize and color directives as described in #45
- Give various emojis to directives, but not to every one.
- Allow directive content to be empty
  - This requires non-trivial (but not too difficult) changes, and may
    introduce some maintenance burden.  It may also cause some
    incompatility with other themes, but probably not much more than
    we already get by our particular styling.
- Improve documentation
  - List all directives, how they work, and recommended uses.
  - Have a gallery of all directives
- Do not remove carpentries-compatibility directives (and do list
  them).
- Review:
  - Read #45, and compare these results to that.
  - Is this a good implementation?  Good directive names?
  - Decide if there is anything to remove or add.
  - Is the "empty content" a good idea?
  - Are the colors good?  (can be improved late)
- Future
  - Change the sample lesson template to use this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants