Dark Mode#
The theme includes a built-in dark mode that users can toggle via the sun/moon icon in the toolbar.
How It Works#
Toggle: Users click the contrast button (sun icon) in the toolbar
Persistence: The preference is saved in
localStorageand applied on subsequent visitsNo flash: Dark mode is applied before the page renders (no FOUC)
Color Palette#
The dark mode uses a modern navy-charcoal palette designed for readability:
Role |
Color |
Usage |
|---|---|---|
Background |
|
Page background |
Surface |
|
Sidebar, cards, admonitions |
Surface Alt |
|
Tooltips, hover states |
Text |
|
Primary body text |
Muted Text |
|
Secondary text, TOC links |
Links |
|
Hyperlinks |
Link Hover |
|
Hovered links |
Link Visited |
|
Previously visited links |
Borders |
|
Dividers, input borders |
Code Background |
|
Code blocks, inputs |
Syntax Highlighting#
Code blocks use a VS Code Dark+ inspired palette:
Token |
Color |
Example |
|---|---|---|
Keywords |
|
|
Strings |
|
|
Numbers |
|
|
Functions |
|
|
Builtins/Classes |
|
|
Comments |
|
|
Variables |
|
|
Operators |
|
|
If you use a custom Pygments style (via qetheme_code_style: False), the dark
mode syntax colors are not applied and your Pygments configuration takes precedence.
Admonitions#
Admonitions automatically adapt with type-specific accent colors:
Admonition Type |
Accent Color |
|---|---|
Note, See Also |
Blue ( |
Warning, Caution, Attention |
Amber ( |
Danger, Error |
Red ( |
Tip, Hint |
Green ( |
Important |
Blue ( |
Image Handling#
Images display with a subtle opacity reduction (88%) rather than color inversion. Hovering over an image restores full brightness.
For projects with a dedicated dark mode logo, see the dark logo configuration. When no dark logo is provided, the theme applies an inversion filter to the site logo.
Customizing Dark Mode Colors#
Override CSS custom properties in a stylesheet in your _static/ directory:
/* _static/custom_dark.css */
body.dark-theme {
--qe-dark-link: #58a6ff;
--qe-dark-bg: #1e1e2e;
}
Available custom properties#
Variable |
Default |
Description |
|---|---|---|
|
|
Page background |
|
|
Cards, sidebars, elevated surfaces |
|
|
Toolbar, inputs, alternate surfaces |
|
|
Borders |
|
|
Primary body text |
|
|
Secondary/muted text |
|
|
Heading text (h2–h5) |
|
|
Top-level heading (h1) |
|
|
Light text (sidebar nav) |
|
|
Link color |
|
|
Link hover color |
|
|
Visited link color |
|
|
Code block background |
|
|
Inline code text color |
|
|
Primary accent (buttons) |
|
|
Accent hover state |
Note
Dark mode works with all other theme features including the sticky TOC, text color schemes (Seoul256, Gruvbox), and git-based metadata.