pub enum DarkPolicy {
Auto,
LightOnly,
Explicit {
accent: Color,
},
}Expand description
How the emitted tokens.css should handle dark mode.
The generated file is appended after the framework’s baked CSS
bundle, so a :root-only override (light values, no dark blocks)
ties the framework’s [data-theme="dark"] on specificity and wins
by source order — leaking light surfaces into dark mode. To avoid
that, emit always writes the dual dark structure the framework
uses: an explicit :root[data-theme="dark"] block (higher
specificity, tie-breaks the toggle) and a
@media (prefers-color-scheme: dark) { :root { … } } auto block
(later source order than the plain :root, so OS-dark without an
explicit toggle is covered too). This enum decides what values
those dark blocks carry.
Variants§
Auto
Auto-derive dark from the resolved light tokens: a brand-agnostic
slate ladder (inverted surfaces, slate text) with the brand
accent lifted until it clears AA_TEXT on the dark surface.
The default.
LightOnly
The brand is light-only. Dark pins to the framework’s default dark palette (slate surfaces + the framework’s lifted teal accent) — a neutral dark override, never light values. Use this to opt out of brand color in dark rather than leak light.
Explicit
Explicit dark accent supplied by the brand author; the dark
blocks lift it for AA_TEXT on the dark surface. Surfaces and
text stay on the framework slate ladder (brand-agnostic, exactly
as the light :root block keeps the chrome ladder brand-agnostic).
Trait Implementations§
Source§impl Clone for DarkPolicy
impl Clone for DarkPolicy
Source§fn clone(&self) -> DarkPolicy
fn clone(&self) -> DarkPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DarkPolicy
Source§impl Debug for DarkPolicy
impl Debug for DarkPolicy
Source§impl Default for DarkPolicy
impl Default for DarkPolicy
Source§fn default() -> DarkPolicy
fn default() -> DarkPolicy
Source§impl PartialEq for DarkPolicy
impl PartialEq for DarkPolicy
Source§fn eq(&self, other: &DarkPolicy) -> bool
fn eq(&self, other: &DarkPolicy) -> bool
self and other values to be equal, and is used by ==.