Skip to content

ReadTheDocs code colors do not react to dark mode properly #122

@aidanfnv

Description

@aidanfnv

Currently the ReadTheDocs site has code blocks in the User Guide that use some default syntax colors (provided by Pygments) when in the furo theme's dark mode, instead of the custom colors used in light mode. This is fine from a readability standpoint (as the light mode colors are not readable in dark mode), but it should ideally use colors that are also custom and more consistent with the light mode colors if possible.

The code blocks in the Standard Modules Reference do not inherit the default colors used by the User Guide in dark mode , so they use the custom colors that were originally meant for light mode. Alternative colors for dark mode can be defined alongside those colors, but "auto" mode can be either light or dark, so those colors cannot be statically defined.

For the User Guide, since the Pygments styling overrides any custom dark mode styling, and is overridden by the custom light mode styling, the custom colors should be custom Pygments styles for consistent behavior between modes. The furo theme being used also allows for a separate pygments_dark_style setting from the pygments_style setting, and presumably furo would properly handle the theme change in its own "auto" mode, so creating custom themes for each should solve any issues with the User Guide.

For the Standard Modules Reference, it may be necessary to have a script that monitors the dark mode setting and switches between different CSS for each style, instead of trying to switch colors in the CSS itself.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions