pub struct Theme { /* private fields */ }Expand description
Runtime paint theme for implicit widget visuals.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn aetna_dark() -> Self
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?
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
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}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}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}Sourcepub fn aetna_light() -> Self
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?
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}Sourcepub fn radix_slate_blue_dark() -> Self
pub fn radix_slate_blue_dark() -> Self
Stock rounded-rect surfaces with a Radix Colors slate + blue dark palette.
Examples found in repository?
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}Sourcepub fn radix_slate_blue_light() -> Self
pub fn radix_slate_blue_light() -> Self
Stock rounded-rect surfaces with a Radix Colors slate + blue light palette.
Examples found in repository?
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}Sourcepub fn radix_sand_amber_dark() -> Self
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?
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}Sourcepub fn radix_sand_amber_light() -> Self
pub fn radix_sand_amber_light() -> Self
Stock rounded-rect surfaces with a Radix Colors sand + amber light palette.
Examples found in repository?
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}Sourcepub fn radix_mauve_violet_dark() -> Self
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?
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}Sourcepub fn radix_mauve_violet_light() -> Self
pub fn radix_mauve_violet_light() -> Self
Stock rounded-rect surfaces with a Radix Colors mauve + violet light palette.
Examples found in repository?
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}Sourcepub fn with_palette(self, palette: Palette) -> Self
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.
Sourcepub fn palette(&self) -> &Palette
pub fn palette(&self) -> &Palette
The active runtime palette.
Examples found in repository?
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}Sourcepub fn metrics(&self) -> &ThemeMetrics
pub fn metrics(&self) -> &ThemeMetrics
The active layout metrics used to resolve stock widget defaults.
Sourcepub fn font_family(&self) -> FontFamily
pub fn font_family(&self) -> FontFamily
The default proportional UI font family applied to text nodes
that do not set .font_family(...) themselves.
Sourcepub fn with_font_family(self, family: FontFamily) -> Self
pub fn with_font_family(self, family: FontFamily) -> Self
Set the default proportional UI font family.
Sourcepub fn mono_font_family(&self) -> FontFamily
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.
Sourcepub fn with_mono_font_family(self, family: FontFamily) -> Self
pub fn with_mono_font_family(self, family: FontFamily) -> Self
Set the default monospace font family for code-tagged text.
Sourcepub fn with_metrics(self, metrics: ThemeMetrics) -> Self
pub fn with_metrics(self, metrics: ThemeMetrics) -> Self
Replace the runtime layout metrics.
Sourcepub fn with_default_component_size(self, size: ComponentSize) -> Self
pub fn with_default_component_size(self, size: ComponentSize) -> Self
Set the default t-shirt size for stock controls.
pub fn with_input_size(self, size: ComponentSize) -> Self
pub fn with_badge_size(self, size: ComponentSize) -> Self
pub fn with_tab_size(self, size: ComponentSize) -> Self
pub fn with_choice_size(self, size: ComponentSize) -> Self
pub fn with_slider_size(self, size: ComponentSize) -> Self
pub fn with_progress_size(self, size: ComponentSize) -> Self
Sourcepub fn resolve(&self, c: Color) -> Color
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.
Sourcepub fn with_surface_shader(self, shader: &'static str) -> Self
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.
Sourcepub fn with_surface_uniform(
self,
key: &'static str,
value: UniformValue,
) -> Self
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.
Sourcepub fn with_role_shader(self, role: SurfaceRole, shader: &'static str) -> Self
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.
Sourcepub fn with_role_uniform(
self,
role: SurfaceRole,
key: &'static str,
value: UniformValue,
) -> Self
pub fn with_role_uniform( self, role: SurfaceRole, key: &'static str, value: UniformValue, ) -> Self
Add a uniform to a specific semantic surface role.
Sourcepub fn with_icon_material(self, material: IconMaterial) -> Self
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.
pub fn icon_material(&self) -> IconMaterial
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.