Material Design 3 semantic color roles
class
UI::Theme
- UI::Theme
- Reference
- Object
Overview
UI::Theme is now an adapter over UI::DesignTokens::Tokens. The public
API (the #primary, #surface, #font_family, corner_radius_* accessors
and the named factories .design_system_default / .apple_default /
.material_baseline) is preserved verbatim so existing call sites keep
compiling, but every default value is now derived from the canonical
UI::DesignTokens::Tokens.default palette and scales.
The Android renderer continues to read brand decisions through this
adapter — its visit-method literal-scrub is deferred to a follow-up phase
per docs/initiative-cross-platform-ui/handoff/phase-01-architect-scope-deferral-2026-05-20.md.
Defined in:
ui/theme.crConstructors
-
.amber_default : Theme
Web design-system theme.
-
.apple_default : Theme
Apple-style theme (HIG defaults).
- .design_system_default : Theme
-
.from_design_tokens(tokens : UI::DesignTokens::Tokens, font_family : String, body_size : Float64, title_size : Float64, headline_size : Float64, caption_size : Float64, corner_small : Float64, corner_medium : Float64, corner_large : Float64) : Theme
Build a
Themefrom aUI::DesignTokens::Tokensinstance. -
.material_baseline : Theme
Material Design 3 baseline theme.
- .new
Class Method Summary
- .amber_tokens : Components::CSS::Tokens::Theme
- .design_system_tokens : Components::CSS::Tokens::Theme
Instance Method Summary
- #background : ThemeColor
- #background=(background : ThemeColor)
- #corner_radius_large : Float64
- #corner_radius_large=(corner_radius_large : Float64)
- #corner_radius_medium : Float64
- #corner_radius_medium=(corner_radius_medium : Float64)
-
#corner_radius_small : Float64
Shape
-
#corner_radius_small=(corner_radius_small : Float64)
Shape
- #error : ThemeColor
- #error=(error : ThemeColor)
- #error_container : ThemeColor
- #error_container=(error_container : ThemeColor)
-
#font_family : String
Typography
-
#font_family=(font_family : String)
Typography
- #font_size_body : Float64
- #font_size_body=(font_size_body : Float64)
- #font_size_caption : Float64
- #font_size_caption=(font_size_caption : Float64)
- #font_size_headline : Float64
- #font_size_headline=(font_size_headline : Float64)
- #font_size_title : Float64
- #font_size_title=(font_size_title : Float64)
- #inverse_on_surface : ThemeColor
- #inverse_on_surface=(inverse_on_surface : ThemeColor)
- #inverse_surface : ThemeColor
- #inverse_surface=(inverse_surface : ThemeColor)
-
#label_primary : LabelRole
Apple semantic label-color roles.
-
#label_primary=(label_primary : LabelRole)
Apple semantic label-color roles.
- #label_quaternary : LabelRole
- #label_quaternary=(label_quaternary : LabelRole)
- #label_secondary : LabelRole
- #label_secondary=(label_secondary : LabelRole)
- #label_tertiary : LabelRole
- #label_tertiary=(label_tertiary : LabelRole)
- #on_background : ThemeColor
- #on_background=(on_background : ThemeColor)
- #on_error : ThemeColor
- #on_error=(on_error : ThemeColor)
- #on_error_container : ThemeColor
- #on_error_container=(on_error_container : ThemeColor)
- #on_primary : ThemeColor
- #on_primary=(on_primary : ThemeColor)
- #on_primary_container : ThemeColor
- #on_primary_container=(on_primary_container : ThemeColor)
- #on_secondary : ThemeColor
- #on_secondary=(on_secondary : ThemeColor)
- #on_secondary_container : ThemeColor
- #on_secondary_container=(on_secondary_container : ThemeColor)
- #on_surface : ThemeColor
- #on_surface=(on_surface : ThemeColor)
- #on_surface_variant : ThemeColor
- #on_surface_variant=(on_surface_variant : ThemeColor)
- #on_tertiary : ThemeColor
- #on_tertiary=(on_tertiary : ThemeColor)
- #on_tertiary_container : ThemeColor
- #on_tertiary_container=(on_tertiary_container : ThemeColor)
- #outline : ThemeColor
- #outline=(outline : ThemeColor)
- #outline_variant : ThemeColor
- #outline_variant=(outline_variant : ThemeColor)
-
#primary : ThemeColor
Material Design 3 semantic color roles
-
#primary=(primary : ThemeColor)
Material Design 3 semantic color roles
- #primary_container : ThemeColor
- #primary_container=(primary_container : ThemeColor)
- #secondary : ThemeColor
- #secondary=(secondary : ThemeColor)
- #secondary_container : ThemeColor
- #secondary_container=(secondary_container : ThemeColor)
- #surface : ThemeColor
- #surface=(surface : ThemeColor)
- #surface_variant : ThemeColor
- #surface_variant=(surface_variant : ThemeColor)
- #tertiary : ThemeColor
- #tertiary=(tertiary : ThemeColor)
- #tertiary_container : ThemeColor
- #tertiary_container=(tertiary_container : ThemeColor)
-
#to_css_custom_properties : String
Generate CSS custom properties string for web rendering.
Constructor Detail
Web design-system theme. Brand colors and typography track the
canonical UI::DesignTokens::Tokens.default.
Apple-style theme (HIG defaults). Derived from
UI::DesignTokens::Tokens.default's Apple-leaning typography +
corner radii; brand colors mirror Apple's stock System Blue / Red /
Gray so existing AppKit callers see no visual change.
Build a Theme from a UI::DesignTokens::Tokens instance. Used by the
named factories above; also a convenience entry point for downstream
apps that want to inject their own branded tokens into the legacy
UI::Theme adapter without forking it.
Material Design 3 baseline theme. Brand colors are derived from
UI::DesignTokens::Tokens.default.colors_light.brand_* so a brand
override on the unified tokens cascades to this adapter automatically.
Class Method Detail
Instance Method Detail
Apple semantic label-color roles. These resolve to dynamic appearance-tracking system colors in the AppKit / UIKit renderers (NSColor.labelColor / UIColor.labelColor and siblings). The stored symbol simply names the role; the renderer owns the lookup.
Apple semantic label-color roles. These resolve to dynamic appearance-tracking system colors in the AppKit / UIKit renderers (NSColor.labelColor / UIColor.labelColor and siblings). The stored symbol simply names the role; the renderer owns the lookup.