Theming
DocsLit supports dark and light themes with automatic system preference detection. Readers can toggle between themes at any time.
How themes work
DocsLit checks the reader's system preference (prefers-color-scheme) on first visit and applies the matching theme. The reader can override this using the theme toggle in the site header. Their choice is saved in localStorage and persists across visits.
Every built-in component automatically adapts to the active theme. You do not need to specify theme-specific styles.
Pinning component themes
You can force a specific theme on any component, regardless of the page theme:
This is useful for showing both appearances side by side in documentation or for ensuring code blocks match a specific style.
Theme attribute
The theme attribute works on all wc-* components:
dark, light. When omitted, the component follows the page theme.
Theme-aware content
Use columns to show how content looks in both themes: