class
Components::CSS::Tokens::Theme
- Components::CSS::Tokens::Theme
- Reference
- Object
Overview
Web-first design-token contract.
The current default palette grew out of the Amber project, but the public component API should use generic design-system names.
Defined in:
components/css/tokens/amber_theme.crConstructors
-
.amber_default : Theme
Builds the legacy light/dark hash from the canonical
UI::DesignTokens::Tokens.defaultpalette. - .design_system_default : Theme
- .new(light : Hash(String, String), dark : Hash(String, String), palettes : Hash(String, Palette), intents : Hash(String, SemanticColor), states : StateScale, typography : TypographyScale, motion : MotionScale, elevation : ElevationScale, radius : RadiusScale)
Instance Method Summary
- #css_variables(scheme : Symbol = :light) : Hash(String, String)
- #dark : Hash(String, String)
- #elevation : ElevationScale
- #intents : Hash(String, SemanticColor)
- #light : Hash(String, String)
- #motion : MotionScale
- #override_token(name : String, value : String, dark_value : String | Nil = nil) : self
- #override_tokens(values : Hash(String, String), dark_values : Hash(String, String) = {} of String => String) : self
- #palettes : Hash(String, Palette)
- #radius : RadiusScale
- #states : StateScale
- #to_css_variables(scheme : Symbol = :light) : String
- #typography : TypographyScale
Constructor Detail
Builds the legacy light/dark hash from the canonical
UI::DesignTokens::Tokens.default palette. Keys that the new
model owns are derived here; keys that remain web-specific
(success-bg-hover variants, focus-ring-solid, state-*) keep their
literal values below so existing call sites and downstream
stylesheets don't regress.
A brand override on UI::DesignTokens::Tokens cascades through
this method because we read the active model at call time, not
at class-load time. Phase 1's WebGenerator is the preferred
cascade path; this method exists for backward compatibility with
consumers of the legacy Components::CSS::Tokens::Theme shape.