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

Would night mode *only* in code cells be useful? #204

Closed
choldgraf opened this issue Jun 19, 2020 · 2 comments
Closed

Would night mode *only* in code cells be useful? #204

choldgraf opened this issue Jun 19, 2020 · 2 comments

Comments

@choldgraf
Copy link
Collaborator

I was thinking about some of our conversations around a "dark theme" in #190 , and it got me wondering if it would be useful to have a "night mode" that only works on code blocks. The Google Cloud docs do this, e.g.:

v5wlmfkb9M

I think it could be straightforward to accomplish the same thing with a relatively lightweight Sphinx extension that wouldn't need to be a part of this theme. I wonder if folks here think that something like this would be useful?

@bollwyvl
Copy link
Collaborator

Been thinking about this on #273. Moving it out of scope might make sense, but I think if one did switch on a dark page theme, it would be least surprising to get that dark code theme... so they would need to coordinate fairly closely, with no flicker, etc.

Presumably such an extension, e.g. sphinx_live_theming might be able to contain all of the complexity of #273, such that it's a few python-level configuration (and then making CSS variables) to add more theme-y business.

As to implementation: the JS localStorage thing is (basically) unavoidable, even for this, as presumably you'd like it persist between page navigations. Hot-swapping the src on the stylesheet might work, but will possible flicker.

For syntax themes, rather than messing about with variables, it might be automateable to actually manipulate the pygments CSS in-flight, e.g.

                                        /* this is what it normally has */
#slt-syntax-zenburn:checked ~ #slt-main .highlight .c { color: #8f5902; font-style: italic } /* Comment */

Not signing up to do the work at this moment, but there are some interesting paths to consider...

@choldgraf
Copy link
Collaborator Author

Closing this as we now have dark mode in #540!

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

2 participants