Support for Dark mode / requirements for theming #12673
Replies: 1 comment
-
Tbh I don't have much experience writing libraries, so apologies if I make a bad suggestion. I'm also not sure how necessary this might be now that Alex provided a good solution. So you'd create a plot as so, adding in the themes (that you want for that plot as some collection of properties) to the properties of the plot. const dark_theme = {"background_fill_color": "black", "border_fill_color": "black"}; //and so on
const plot = Bokeh.Plotting.figure({
title: 'Example',
height: 450,
width: 650,
x_axis_label: "x",
y_axis_label: "y",
themes: {"dark": , "light": [] }; //Where the empty arrays are collections of properties of an array
}); Then the figure API could have a |
Beta Was this translation helpful? Give feedback.
-
There have been various requests over time and in different context for the ability to support "dark mode". I'd like to brainstorm what this might look like from a high level and then try to decompose some specific tasks into issues. Off the top of my head, this seems like a potential approach:
Augment current "single theme per doc" capability
Specifically, make it possible to ship multiple themes within a document, and have the ability to switch between which one is currently active. I think the means having the document store a mapping of string names / identifiers to themes for this purpose, since users will want to identify themes in a way that is meaningful to their usage. But if there are other ideas I would love to hear them.
Add hook for responding to light/dark mode
A prerequisite for any "automatic" switching. I don't actually have much of an idea what this looks like technically, but I assume there are some common mechanisms we can make use of (e.g.
media (prefers-color-scheme: dark)
and the like?) It would be good to get a clearer idea of what options are available for this.Convenience APIs
With the above two it would be possible for users to add some hook callback to switch themes programmatically, but we might want to make things simpler, by exposing options to specify themes to use for light and dark as a configuration, and the we take care of making that happen.
cc @bokeh/dev
Beta Was this translation helpful? Give feedback.
All reactions