Color Scheme

Support light mode, dark mode, and system preference detection in consent components.

c15t supports light and dark mode through the theme's colors and dark token groups. The active color scheme is determined by one of three methods:

  1. Explicit setting via the colorScheme option
  2. CSS class detection - c15t checks for .dark on the document element
  3. System preference - matches prefers-color-scheme media query

Configuration

Set the color scheme on the provider:

useColorScheme Hook

For programmatic control over the color scheme:

ValueBehavior
'light'Force light mode
'dark'Force dark mode
'system'Follow prefers-color-scheme media query
nullDisable - c15t won't manage color scheme

How Dark Mode Works

When dark mode is active, c15t applies the dark token values as CSS variable overrides. Only tokens specified in dark are overridden - unset tokens fall back to the colors values.