Skip to main content

Theme

Struct Theme 

Source
pub struct Theme { /* private fields */ }
Expand description

Runtime paint theme for implicit widget visuals.

Implementations§

Source§

impl Theme

Source

pub fn aetna_dark() -> Self

Current default: stock rounded-rect surfaces with the Aetna Dark palette (copied from shadcn/ui zinc dark) and compact desktop metrics.

Examples found in repository?
examples/polish_calibration.rs (line 17)
12fn main() -> std::io::Result<()> {
13    let viewport = Rect::new(0.0, 0.0, 1180.0, 876.0);
14    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
15
16    let name = "polish_calibration";
17    let theme = Theme::aetna_dark();
18    let mut root = polish_calibration();
19    let bundle = render_bundle_themed(&mut root, viewport, &theme);
20    let written = write_bundle(&bundle, &out_dir, name)?;
21    for p in &written {
22        println!("wrote {}", p.display());
23    }
24    if !bundle.lint.findings.is_empty() {
25        eprintln!(
26            "\nlint findings for {name} ({}):",
27            bundle.lint.findings.len()
28        );
29        eprint!("{}", bundle.lint.text());
30    }
31
32    Ok(())
33}
More examples
Hide additional examples
examples/settings_calibration.rs (line 14)
9fn main() -> std::io::Result<()> {
10    let viewport = Rect::new(0.0, 0.0, 1180.0, 780.0);
11    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
12
13    let name = "settings_calibration";
14    let theme = Theme::aetna_dark();
15    let mut root = settings_calibration();
16    let bundle = render_bundle_themed(&mut root, viewport, &theme);
17    let written = write_bundle(&bundle, &out_dir, name)?;
18    for p in &written {
19        println!("wrote {}", p.display());
20    }
21    if !bundle.lint.findings.is_empty() {
22        eprintln!(
23            "\nlint findings for {name} ({}):",
24            bundle.lint.findings.len()
25        );
26        eprint!("{}", bundle.lint.text());
27    }
28
29    Ok(())
30}
examples/dashboard_01_calibration.rs (line 14)
9fn main() -> std::io::Result<()> {
10    let viewport = Rect::new(0.0, 0.0, 1180.0, 780.0);
11    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
12
13    let name = "dashboard_01_calibration";
14    let theme = Theme::aetna_dark();
15    let mut root = dashboard_01_calibration();
16    let bundle = render_bundle_themed(&mut root, viewport, &theme);
17    let written = write_bundle(&bundle, &out_dir, name)?;
18    for p in &written {
19        println!("wrote {}", p.display());
20    }
21    if !bundle.lint.findings.is_empty() {
22        eprintln!(
23            "\nlint findings for {name} ({}):",
24            bundle.lint.findings.len()
25        );
26        eprint!("{}", bundle.lint.text());
27    }
28
29    Ok(())
30}
examples/palette_demo.rs (line 19)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn aetna_light() -> Self

Stock rounded-rect surfaces with the Aetna Light palette (copied from shadcn/ui zinc light). Drop-in alternative to Self::aetna_dark — token references swap rgba at paint time without rebuilding the widget tree.

Examples found in repository?
examples/palette_demo.rs (line 23)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn radix_slate_blue_dark() -> Self

Stock rounded-rect surfaces with a Radix Colors slate + blue dark palette.

Examples found in repository?
examples/palette_demo.rs (line 28)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn radix_slate_blue_light() -> Self

Stock rounded-rect surfaces with a Radix Colors slate + blue light palette.

Examples found in repository?
examples/palette_demo.rs (line 33)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn radix_sand_amber_dark() -> Self

Stock rounded-rect surfaces with a Radix Colors sand + amber dark palette — warm sepia neutrals with a bright amber accent.

Examples found in repository?
examples/palette_demo.rs (line 38)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn radix_sand_amber_light() -> Self

Stock rounded-rect surfaces with a Radix Colors sand + amber light palette.

Examples found in repository?
examples/palette_demo.rs (line 43)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn radix_mauve_violet_dark() -> Self

Stock rounded-rect surfaces with a Radix Colors mauve + violet dark palette — purple-tinged neutrals with a violet accent.

Examples found in repository?
examples/palette_demo.rs (line 48)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn radix_mauve_violet_light() -> Self

Stock rounded-rect surfaces with a Radix Colors mauve + violet light palette.

Examples found in repository?
examples/palette_demo.rs (line 53)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn with_palette(self, palette: Palette) -> Self

Replace the runtime color palette. Token references resolve through the active palette at paint time, so this swaps surface rgba without rebuilding the widget tree.

Source

pub fn palette(&self) -> &Palette

The active runtime palette.

Examples found in repository?
examples/palette_demo.rs (line 58)
14fn main() -> std::io::Result<()> {
15    let viewport = Rect::new(0.0, 0.0, 1220.0, 1040.0);
16    let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
17
18    let variants = [
19        ("palette_demo.aetna_dark", "Aetna dark", Theme::aetna_dark()),
20        (
21            "palette_demo.aetna_light",
22            "Aetna light",
23            Theme::aetna_light(),
24        ),
25        (
26            "palette_demo.radix_slate_blue_dark",
27            "Radix slate + blue dark",
28            Theme::radix_slate_blue_dark(),
29        ),
30        (
31            "palette_demo.radix_slate_blue_light",
32            "Radix slate + blue light",
33            Theme::radix_slate_blue_light(),
34        ),
35        (
36            "palette_demo.radix_sand_amber_dark",
37            "Radix sand + amber dark",
38            Theme::radix_sand_amber_dark(),
39        ),
40        (
41            "palette_demo.radix_sand_amber_light",
42            "Radix sand + amber light",
43            Theme::radix_sand_amber_light(),
44        ),
45        (
46            "palette_demo.radix_mauve_violet_dark",
47            "Radix mauve + violet dark",
48            Theme::radix_mauve_violet_dark(),
49        ),
50        (
51            "palette_demo.radix_mauve_violet_light",
52            "Radix mauve + violet light",
53            Theme::radix_mauve_violet_light(),
54        ),
55    ];
56
57    for (file_name, label, theme) in variants {
58        let mut root = palette_demo(label, theme.palette());
59        let bundle = render_bundle_themed(&mut root, viewport, &theme);
60        let written = write_bundle(&bundle, &out_dir, file_name)?;
61        for p in &written {
62            println!("wrote {}", p.display());
63        }
64
65        if !bundle.lint.findings.is_empty() {
66            eprintln!(
67                "\nlint findings for {file_name} ({}):",
68                bundle.lint.findings.len()
69            );
70            eprint!("{}", bundle.lint.text());
71        }
72    }
73
74    Ok(())
75}
Source

pub fn metrics(&self) -> &ThemeMetrics

The active layout metrics used to resolve stock widget defaults.

Source

pub fn font_family(&self) -> FontFamily

The default proportional UI font family applied to text nodes that do not set .font_family(...) themselves.

Source

pub fn with_font_family(self, family: FontFamily) -> Self

Set the default proportional UI font family.

Source

pub fn mono_font_family(&self) -> FontFamily

The default monospace font family applied to text nodes that render as code (font_mono = true, TextRole::Code) and do not set .mono_font_family(...) themselves. Independent of Self::font_family — swapping the proportional face leaves the code face alone, and vice versa.

Source

pub fn with_mono_font_family(self, family: FontFamily) -> Self

Set the default monospace font family for code-tagged text.

Source

pub fn with_metrics(self, metrics: ThemeMetrics) -> Self

Replace the runtime layout metrics.

Source

pub fn with_default_component_size(self, size: ComponentSize) -> Self

Set the default t-shirt size for stock controls.

Source

pub fn with_button_size(self, size: ComponentSize) -> Self

Source

pub fn with_input_size(self, size: ComponentSize) -> Self

Source

pub fn with_badge_size(self, size: ComponentSize) -> Self

Source

pub fn with_tab_size(self, size: ComponentSize) -> Self

Source

pub fn with_choice_size(self, size: ComponentSize) -> Self

Source

pub fn with_slider_size(self, size: ComponentSize) -> Self

Source

pub fn with_progress_size(self, size: ComponentSize) -> Self

Source

pub fn resolve(&self, c: Color) -> Color

Shorthand for self.palette().resolve(c). Library code that derives a color from a token (e.g. via darken/lighten/mix) should resolve through the palette before applying the op so the derivation is computed against the active palette’s rgb, not the token’s compile-time fallback.

Source

pub fn with_surface_shader(self, shader: &'static str) -> Self

Route all implicit surfaces through a custom shader.

The draw-op pass still emits the familiar rounded-rect uniforms (fill, stroke, radius, shadow, focus_color, …). When rounded_rect_slots is enabled, those values are also copied into vec_a..vec_d, matching the cross-backend [crate::paint::QuadInstance] ABI so custom shaders can be drop-in material replacements.

Source

pub fn with_surface_uniform( self, key: &'static str, value: UniformValue, ) -> Self

Add a uniform to every implicit surface draw. Existing node uniforms win, so a local widget override can still specialize a shader parameter.

Source

pub fn with_role_shader(self, role: SurfaceRole, shader: &'static str) -> Self

Route a specific semantic surface role through a custom shader. Roles without an override use the global surface recipe.

Source

pub fn with_role_uniform( self, role: SurfaceRole, key: &'static str, value: UniformValue, ) -> Self

Add a uniform to a specific semantic surface role.

Source

pub fn with_icon_material(self, material: IconMaterial) -> Self

Select the stock material used by native vector icon painters. Backends without vector icon support may ignore this while still preserving the theme value for API parity.

Source

pub fn icon_material(&self) -> IconMaterial

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Theme

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Theme

§

impl RefUnwindSafe for Theme

§

impl Send for Theme

§

impl Sync for Theme

§

impl Unpin for Theme

§

impl UnsafeUnpin for Theme

§

impl UnwindSafe for Theme

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.