-
Notifications
You must be signed in to change notification settings - Fork 85
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
👌 IMPROVE: Update ANSI CSS colors #384
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
cheers! |
Codecov Report
@@ Coverage Diff @@
## master #384 +/- ##
=======================================
Coverage 80.44% 80.44%
=======================================
Files 21 21
Lines 2132 2132
=======================================
Hits 1715 1715
Misses 417 417
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
note the failures in the tests are just because of ipython updating to v8. I'll make another PR to pin that to v7 for now |
Thank you! I hope I copied all the colors properly, might be good to double check just to make sure... |
Looks good to me: https://myst-nb--384.org.readthedocs.build/en/384/use/formatting_outputs.html#ansi-outputs maybe if you also want to give a look |
Thanks for looking, yeah I just doubled check I copied things correctly, all seems good. |
A quick comparison from the preview: Old: New: I think that overall it is certainly easier to read - though the "short demo" snippet that precedes the table is harder to read with the new ANSI colors. Though unless those colors were chosen because they need to be legible, maybe we should just pick different colors? The table is probably the most important reference to use |
Thanks for running the comparison! I am open to any colors, these are at least readable on a lighter background, which is the main thing that was important to me for the example. It seems like these were originally added in mgeier/notebook@7bee6c5 by @mgeier (jupyter/notebook#1230) |
Actually, if we are going to do this "properly", then we should probably change them to CSS variables and implement dark mode switching 😉 |
It looks like the original choice was (jupyter/nbconvert#259):
Sounds good long term! But having a visible yellow would be great short term... (i.e. I don't feel up to doing it properly!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that CSS variables are a better long-term solution, this seems like a nice improvement to me though and the colors in general seem reasonable. It'd be nice if that first example used a different set of ANSI colors so it was more readable, but I don't think it needs to block the PR
There seems to have been a bit of confusion with the "intense" color variants, because I guess those are not implemented yet? For comparison, this is how it is supposed to look like: https://nbsphinx.readthedocs.io/en/latest/code-cells.html#ANSI-Colors
The idea is that red is red, regardless of the background color. However, there are two special CSS classes: For example, this is where they are set in JupyterLab: https://github.com/jupyterlab/jupyterlab/blob/ea1529b6683adb692b1c9908f04d0a2cead44a9f/packages/rendermime/style/base.css#L164-L168 It's of course also possible to switch all the colors when switching from light to dark mode, but I was hoping to be able to avoid this. |
@mgeier I used the second color in each definition as the background color, maybe that was incorrect? Some of them matched our existing background colors, so I thought it seemed OK. |
Well, "incorrect" is a strong word. The second color is supposed to be the "intense" one. You can of course use any colors you want, nothing is "incorrect", but if you want to match JupyterLab and the Classic Notebook (and |
Thanks for the clarification. I updated the background colors to be those from the npshinx ANSI colors page you posted. |
Hey @saulshanabrook, if you want to fix the merge conflicts, then we can revisit this |
@chrisjsewell just merged! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cheers!
Currently, when displaying terminal output in Jupyter Book, the default colors are a bit hard to read.
For example, this is some CLI output using Rich's default color encoding:
The yellow in particular is very light.
This is the same page, after changing the yellow manually to the new color:
I copied all of the colors from Jupyter Notebook. You can see there it's much more legible:
I noticed that Jupyter Notebook itself changed their colors in 2017: jupyter/notebook#3286