-
Notifications
You must be signed in to change notification settings - Fork 5
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
Custom code-block colours #33
Comments
The supported way to do this with Sphinx and Pygment is to set the Sphinx option, The unsupported way would be to override the specific CSS used for highlighting in Sphinx's HTML output, e.g. something like: .highlight-json .nt { color: purple } /* NT = Name.Tag = JSON object field */ Upside is we can restyle JSON highlighting without affecting other highlighted blocks that may contain Name.Tag tokens (produced by Pygments lexers). Downsides are that this will break if the Pygments JSON lexer changes or the CSS generation changes, and it won't apply to non-HTML output. (Not sure if these get any use currently, though I believe RTD is producing them.) Other downside is we can't restyle whole families of lexed tokens, like the |
Builtin styles! Yay! Now to choose one... I've always liked solarized-light and I think a (subtle) background colour for code blocks would be a good idea. |
Here's how nextstrain/docs.nextstrain.org#113 looks after adding I attempted to add this to our theme (i.e. this repo) via changing
python3 -m pip install -e . and make html which I'm guessing isn't right?
|
Hmm. I've always found Solarized Light to be a bit low contrast in many cases, e.g. as in here
That's the right thing to do… and it works for me (see screenshot above). Maybe you need a |
The current JSON code-fences use an unfortunate green/red colour combo, which I'd like to change!
The colours are defined in
pygments.css
. Unsure of the best approach to extending this / overwriting these innextstrain.css
but if someone could provide the framework I'll happily change some colours 😄An example:
The text was updated successfully, but these errors were encountered: