Skip to content

HTML repr dark/light themes in Sphinx Furo #6500

@kmpaul

Description

@kmpaul

What is your issue?

The Xarray HTML repr assumes that light vs dark theming is stored in the html element's theme attribute (i.e., <html theme="dark"> or <html theme="light">).

However, the Sphinx Furo theme assumes that light vs dark theming is stored in the body element's data-theme attribute. As a result, if you use the Sphinx Furo theme for documentation and use Xarray HTML reprs, the Xarray HTML reprs do not display properly.

In truth, it seems that this comes down to the light vs dark theming not being standardized, which presents a problem of how to support multiple (possibly innumerable) different ways of specifying light or dark themes. That said, the Sphinx Furo theme has growing popularity, and I wonder if it could be supported as a special case (as is vscode dark themes).

To do this, one would need only modify one line of xarray/static/css/style.css:

html[theme=dark],
body.vscode-dark {

to:

html[theme=dark],
body[data-theme=dark],
body.vscode-dark {

If this is something that the Xarray community would support, I'm happy to put together a PR to do this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions