Skip to content

Reconsider dark mode default behavior #684

@philippjfr

Description

@philippjfr

I really love, love, love the work on the dark theme (and pydata-sphinx-theme in general) but having just tried it on some of our websites I'm wondering whether adding the toggle (and the default_mode: 'auto' behavior) should be opt-in by default. What I found was that since my system is set to dark mode it automatically switched the website to dark mode on render.

Now the dark mode probably works fabulously for websites that consist primarily of text and code, but as soon as you have any rich output such as pictures, plots, etc. the dark mode is visually very painful because in most cases these contents cannot easily be adapted to accommodate both modes. Let's take a matplotlib plot with transparent background as example:

Screen Shot 2022-05-28 at 16 43 05

Not only is the white on black contrast glaring but the axis labels are basically invisible. Any MathJax equations presumably would have the same issue and become basically invisible (although I have not tested this). Similarly now let's look at some bokeh content:

Screen Shot 2022-05-28 at 16 44 49

Now you could say that this is our job to ensure that bokeh correctly toggles themes based on the media query. That's possible true but practically it means that while this is not handled any bokeh output will look terrible when rendered with v0.9.

Since adapting all the contents to render nicely in dark mode will take many library authors some time, I would suggest that at least initially the dark theme switch and the auto default behavior be opt-in. Alternatively, I would suggest documenting how to disable them easily, as this required some digging in the source code:

html_theme_options = {
...
    "navbar_end": ["navbar-icon-links"],
}

html_context.update({
    "default_mode": "light"
})

and causes errors in the pydata_sphinx_theme JS since the switch can't be found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact: block-releaseShould block a release from happening. Only use if this is a critical problem we don't want to ship

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions