Skip to main content

Crate swatches

Crate swatches 

Source
Expand description

Strict appearance themes with no renderer or global configuration.

use swatches::{Theme, AppearancePatch};
let theme = Theme::parse(include_str!("../themes/swatches.toml"))?;
let appearance = theme.appearance().with_overrides(&AppearancePatch::default());
assert_eq!(appearance.background.channels(), [16, 37, 63]);

Structs§

Appearance
Renderer-independent resolved values. Apps provide their own defaults.
AppearancePatch
Explicit app values only. Do not default-fill app config before mapping it.
Colors
The six semantic colors required by a theme.
Error
An error produced while resolving, reading, or parsing a theme.
Font
The font settings required by a theme.
FontFamily
A nonempty family name; resolution to an installed font belongs to the app.
Rgb
An opaque, sRGB color. Alpha is owned by the application.
Theme
A complete v1 document; incomplete themes are rejected rather than invented.

Functions§

resolve
Resolves application defaults, then an optional complete theme, then explicit fields.
resolve_theme_path
Resolve a configured path without consulting the process environment.