Skip to main content

Module theme

Module theme 

Source
Expand description

Theme tokens for colors and corner radii.

A style can name a theme token instead of a literal value. The token resolves to a concrete Color or radius when the node paints, so switching the theme changes every node that uses a token and no other. Theme holds the values the tokens resolve against; an application picks the built-in light or dark theme with Theme::light and Theme::dark, or fills one of its own.

use smudge_core::geometry::Color;
use smudge_core::theme::{ColorToken, Theme};
use smudge_core::widget::panel;

let card = panel().background(ColorToken::SURFACE);
let theme = Theme::light();
assert_eq!(theme.color(ColorToken::SURFACE), Color::WHITE);

Structs§

ColorToken
The name of a color in a Theme.
RadiusToken
The name of a corner radius in a Theme.
Theme
The values that theme tokens resolve against.

Enums§

ColorValue
A color that is either a literal or a named theme token.
RadiusValue
A corner radius that is either a literal or a named theme token.