Overview

qwik-docs includes a complete theming system with dark, light, and auto modes. The system is built on CSS custom properties (design tokens) and managed by the ThemeProvider and ThemeSelect components.

Theme Modes

ModeBehavior
LightForces light color scheme
DarkForces dark color scheme
AutoFollows the OS/browser prefers-color-scheme setting

Try switching — use the theme toggle in the top-right corner.

Design Tokens

All visual properties are defined as CSS custom properties in design-tokens/props.css. Key categories:

Colors

TokenPurpose
--sl-color-bgPage background
--sl-color-bg-navHeader background
--sl-color-bg-sidebarSidebar background
--sl-color-textPrimary text color
--sl-color-text-accentAccent/link color
--sl-color-hairlineBorder/divider color
--sl-color-gray-*Gray scale (1-7)
--sl-color-accent-*Accent color scale

Typography

TokenPurpose
--sl-fontBody font family
--sl-font-monoMonospace font family
--sl-text-*Font size scale
--sl-line-heightDefault line height

Spacing

TokenPurpose
--sl-content-widthMax content width
--sl-sidebar-widthSidebar width
--sl-content-pad-xHorizontal content padding

CSS Layers

Styles are organized into CSS @layer declarations for specificity management:

@layer reset, tokens, base, components, utilities;

This ensures design tokens can be overridden predictably.

Theme-Aware Classes

Components use special classes to show/hide elements per theme:

ClassBehavior
.light:sl-hiddenHidden in light mode
.dark:sl-hiddenHidden in dark mode

This is used by SiteTitle for theme-specific logos.

Customization

Override any design token in your global.css:

:root {
  --sl-color-accent-high: #e040fb;
  --sl-font: 'Inter', system-ui, sans-serif;
  --sl-content-width: 75ch;
}

Component Architecture

ThemeProvider (renders icon templates)
    ↓
ThemeSelect (dropdown UI)
    ↓ onChange
Updates <html data-theme="...">
    ↓
CSS responds via [data-theme] selectors