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

Support JupyterLab dark mode in dashboard plots #5200

Open
gjoseph92 opened this issue Aug 11, 2021 · 2 comments
Open

Support JupyterLab dark mode in dashboard plots #5200

gjoseph92 opened this issue Aug 11, 2021 · 2 comments
Assignees

Comments

@gjoseph92
Copy link
Collaborator

When using the dask labextension, plots are hard to read in dark mode because some of the colors don't adjust:

Screen Shot 2021-08-10 at 9 31 54 PM

Text colors do change (titles, ticks) but others don't. Even just getting the grid lines to be dark instead of light would be 90% of the way to usability.

That said, I highly doubt there's a way for the dashboard to actually know it's being viewed by JupyterLab in dark mode. Since the plots are all iframe'd, we couldn't even do it with CSS variables that Jupyter sets, right? Maybe the extension could inform the scheduler to please change its dashboard theme?

xref #2305, jupyterlab/jupyterlab#3855

@ian-r-rose
Copy link
Collaborator

Longer term, if there dashboard can be themed then that would be the way forward, as you suggest. If there are ways we could pass a theme as a URL query that could work for dynamically choosing a theme, or it could just be separately configurable.

I am actually surprised that anything changes right now, since we don't pass any theme information to bokeh. I've noticed it before, but am not sure how bokeh reasons about/discovers the information to change it's text colors. @bryevdv do you have any suggestions about how to investigate that?

I'm given to think that, unless there is an easy way for bokeh to change more colors for theming purposes, that we should just set a white background on the iframes until #2305 is resolved.

@bryevdv
Copy link
Contributor

bryevdv commented Aug 13, 2021

@ian-r-rose @gjoseph92 Bokeh relies on whatever theme is explicitly set on the document, and doesn't do any sort of external discovery at all to set that theme. I don't actually think the text colors above have changed. I inspected both the image above and and a locally running vanilla dashboard, and the center of the letters in the plot titles, etc. is RGB (68, 68, 68) in both cases. What is different is the antialiased pixels of the edge of the text, which are darker above, and lighter in the the vanilla dashboard.

The only things that could conceivable react "automatically" are non-canvas elements, which include widgets and hover tools, since they are styled via CSS. Nothing on the canvas is styled with CSS, since canvas does not support that. However, we do try to namespace our CSS fairly rigidly so I'd also be surprised if external CSS changes showed up on non-canvas elements, either.

As for how to move forward, I'm not very familiar with jupyter-lab extensions (and tbh I try to avoid Jupyter, mostly) Can the dark labextension call python code in the kernel? If so then perhaps the curdoc().theme could be changed via that. If not, then it's possible that the bokeh Jupyter extension might need new development to expose some supported mechanism for changing themes via JS. We would probably need help/collaboration to make sure the actual requirements are met in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants