-
Notifications
You must be signed in to change notification settings - Fork 321
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
Make JupyterLab CSS align with the CSS of this theme #745
Comments
I wonder if we could implement a way for the user to configure the JupyterLab theme they want to use: html_theme_options = {
# Would use https://github.com/timkpaine/jupyterlab_miami_nights
# (first need to be installed on the docs build machine)
"jupyterlab-theme": "@timkpaine/jupyterlab_miami_nights"
} Then I guess we need to implement a bridge from the JupyterLab variables to the pydata-theme variables for the JupyterLab theme to properly apply? --pst-color-primary: var(--jp-brand-color0);
--pst-color-success: var(--jp-success-color0);
/* etc... */ |
Happy to help on this one |
Is there a way to trigger from dark to light theme in jupyterlite ? --jp-brand-color0: var(--pst-color-primary) !important; To adapt jupyterLite to us and not the other way around (there are plenty of other sphinx theme and they should'nt be forced to use pst var) |
Yes, I guess there are two separate things we could consider: 1 - Have the pydata-sphinx theme switch be propagated to JupyterLite when JupyterLite is embedded in sphinx (what Chris suggested in the issue) and JupyterLite respect the CSS variables from pydata-sphinx I suppose those two could probably be two separate issues/PRs and can be both implemented. I fear the first proposition might be difficult because JupyterLite runs in an iframe (at least that's how https://github.com/jupyterlite/jupyterlite-sphinx is implemented), so sharing CSS and have the switch event propagate might be tricky (impossible?)
Yes, you can add the JavaScript logic to manipulate the JupyterLab theme manager and make it use a new theme. |
look like it's doable: https://stackoverflow.com/a/217833/6734243 (I'm not 100% that it's applicable here as I don't know how jupyterlite works) |
I think a relatively low hanging fruit could be to just add an event listener callback to our theme function to trigger some JS that manually sets the jupyterlab theme to the same, if it is embedded on the page. I think people would be ok with "slightly different but still dark" themes, that's already a huge improvement even if some colors are slightly off. @psychemedia might think this is cool as well |
Being able to synch themes "for free" could be really handy, esp if the end user has control of the light and dark theme... Would this be limited to very specific themes, and would there be a boolean to optionally (dis)able this? Is there any guidance / policy on setting JupyterLab/Lite and Sphinx themes so they colour co-ordinate? Also, I wonder: co-ordinated language packs (if sphinx supports language packs?)?! |
@jtpio just linked this in another thread https://jupyterlite.readthedocs.io/en/stable/howto/configure/advanced/iframe.html It showcases an example making a jupyterlite plugin allowing to set the theme from outside of the iframe. We could provide such a plugin by default in jupyterlite-sphinx, allowing pydata-sphinx-theme to notify jupytelite iframes of a potential theme change. |
That would be perfect, at the end of the day we have the whole infrastructure ready, we just miss a handle from JupyterLite side to trigger a change so anything that you have is a very good news ! |
what kind of handled would you like ? |
Bringing in @gabalafou for opinions/thoughts (also there is #1740 which is somewhat related via #1740 (comment)) |
Context
JupyterLab is a very popular interface that is used by many in the PyData ecosystem, and that is increasingly becoming easier to embed directly into HTML pages via projects like JupyterLite. I suspect that over time, we'll see more documentation sites embedding live Jupyter kernels into Sphinx docs.
The PyData theme has a set of color variables that define dark/light themes.
JupyterLab has its own notion of a "light and dark mode", though this is presumably structured differently from this theme's CSS variables etc.
Suggestion
This theme could somehow trigger the respective mode in JupyterLab when it was embedded in the PyData Sphinx Theme. I think there are roughly two things to improve here:
Would love feedback on whether this would be interesting/useful, or ideas for implementation! cc @martinRenou who was interested in this too.
References
The text was updated successfully, but these errors were encountered: