class Components::CSS::Tokens::Theme

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.amber_default : Theme #

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.


[View source]
def self.design_system_default : Theme #

[View source]
def self.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) #

[View source]

Instance Method Detail

def css_variables(scheme : Symbol = :light) : Hash(String, String) #

[View source]
def dark : Hash(String, String) #

[View source]
def elevation : ElevationScale #

[View source]
def intents : Hash(String, SemanticColor) #

[View source]
def light : Hash(String, String) #

[View source]
def motion : MotionScale #

[View source]
def override_token(name : String, value : String, dark_value : String | Nil = nil) : self #

[View source]
def override_tokens(values : Hash(String, String), dark_values : Hash(String, String) = {} of String => String) : self #

[View source]
def palettes : Hash(String, Palette) #

[View source]
def radius : RadiusScale #

[View source]
def states : StateScale #

[View source]
def to_css_variables(scheme : Symbol = :light) : String #

[View source]
def typography : TypographyScale #

[View source]