1use std::collections::HashMap;
20
21use crate::canvas::{FontSpec, FontWeight, Shadow};
22use crate::color::Color;
23use crate::component::ControlState;
24use crate::geometry::Bounds;
25
26#[derive(Clone, Debug, PartialEq)]
28pub enum ColorRef {
29 Token(String),
30 Value(Color),
31}
32
33impl From<Color> for ColorRef {
34 fn from(c: Color) -> Self {
35 ColorRef::Value(c)
36 }
37}
38
39impl From<&str> for ColorRef {
41 fn from(s: &str) -> Self {
42 match Color::from_hex(s) {
43 Some(c) if s.trim_start().starts_with('#') => ColorRef::Value(c),
44 _ => ColorRef::Token(s.to_string()),
45 }
46 }
47}
48
49#[derive(Clone, Debug, PartialEq)]
51pub enum Metric {
52 Token(String),
53 Value(f32),
54}
55
56impl From<f32> for Metric {
57 fn from(v: f32) -> Self {
58 Metric::Value(v)
59 }
60}
61
62impl From<&str> for Metric {
63 fn from(s: &str) -> Self {
64 Metric::Token(s.to_string())
65 }
66}
67
68#[derive(Clone, Debug, Default, PartialEq)]
70pub struct StyleProps {
71 pub fill: Option<ColorRef>,
72 pub text: Option<ColorRef>,
73 pub border_color: Option<ColorRef>,
74 pub border_width: Option<f32>,
75 pub radius: Option<Metric>,
77 pub padding: Option<Bounds>,
78 pub font: Option<String>,
80 pub opacity: Option<f32>,
81 pub transition: Option<Metric>,
83 pub shadow: Option<String>,
85 pub material: Option<String>,
88 pub reveal: Option<String>,
92 pub reveal_color: Option<ColorRef>,
95 pub reveal_radius: Option<f32>,
97 pub text_case: Option<String>,
99 pub letter_spacing: Option<f32>,
101 pub border_sides: Option<Bounds>,
104 pub border_style: Option<String>,
106 pub line_height: Option<f32>,
109 pub font_weight: Option<crate::canvas::FontWeight>,
112 pub font_size: Option<f32>,
113 pub italic: Option<bool>,
114 pub gap: Option<f32>,
118 pub icon_size: Option<f32>,
121 pub icon_color: Option<ColorRef>,
122 pub icon_gap: Option<f32>,
123 pub width: Option<f32>,
126 pub item_height: Option<f32>,
128 pub separator_height: Option<f32>,
130 pub thumb: Option<ColorRef>,
133 pub scroll_bar: Option<Box<Style>>,
135}
136
137#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
139pub enum Material {
140 #[default]
141 None,
142 Glass,
144 Frosted,
146}
147
148#[derive(Clone, Copy, Debug, Default, PartialEq)]
151pub struct Reveal {
152 pub border: bool,
154 pub background: bool,
156 pub color: Color,
158 pub radius: f32,
160}
161
162impl Reveal {
163 pub fn on(&self) -> bool {
165 (self.border || self.background) && self.radius > 0.0 && self.color.a > 0
166 }
167}
168
169impl Material {
170 pub fn parse(name: &str) -> Material {
171 match name {
172 "glass" => Material::Glass,
173 "frosted" | "acrylic" => Material::Frosted,
174 _ => Material::None,
175 }
176 }
177
178 pub fn blur(self) -> f32 {
180 match self {
181 Material::None => 0.0,
182 Material::Glass => 8.0,
183 Material::Frosted => 22.0,
184 }
185 }
186}
187
188impl StyleProps {
189 pub fn new() -> Self {
190 Self::default()
191 }
192
193 pub fn fill(mut self, c: impl Into<ColorRef>) -> Self {
194 self.fill = Some(c.into());
195 self
196 }
197
198 pub fn text(mut self, c: impl Into<ColorRef>) -> Self {
199 self.text = Some(c.into());
200 self
201 }
202
203 pub fn border(mut self, c: impl Into<ColorRef>, width: f32) -> Self {
204 self.border_color = Some(c.into());
205 self.border_width = Some(width);
206 self
207 }
208
209 pub fn radius(mut self, m: impl Into<Metric>) -> Self {
210 self.radius = Some(m.into());
211 self
212 }
213
214 pub fn padding(mut self, b: impl Into<Bounds>) -> Self {
215 self.padding = Some(b.into());
216 self
217 }
218
219 pub fn font(mut self, name: &str) -> Self {
220 self.font = Some(name.to_string());
221 self
222 }
223
224 pub fn opacity(mut self, v: f32) -> Self {
225 self.opacity = Some(v);
226 self
227 }
228
229 pub fn transition(mut self, m: impl Into<Metric>) -> Self {
230 self.transition = Some(m.into());
231 self
232 }
233
234 pub fn shadow(mut self, token: &str) -> Self {
235 self.shadow = Some(token.to_string());
236 self
237 }
238
239 pub fn material(mut self, name: &str) -> Self {
241 self.material = Some(name.to_string());
242 self
243 }
244
245 pub fn reveal(mut self, mode: &str) -> Self {
247 self.reveal = Some(mode.to_string());
248 self
249 }
250
251 pub fn merge(&mut self, other: &StyleProps) {
253 if other.fill.is_some() {
254 self.fill.clone_from(&other.fill);
255 }
256 if other.text.is_some() {
257 self.text.clone_from(&other.text);
258 }
259 if other.border_color.is_some() {
260 self.border_color.clone_from(&other.border_color);
261 }
262 if other.border_width.is_some() {
263 self.border_width = other.border_width;
264 }
265 if other.radius.is_some() {
266 self.radius.clone_from(&other.radius);
267 }
268 if other.padding.is_some() {
269 self.padding = other.padding;
270 }
271 if other.font.is_some() {
272 self.font.clone_from(&other.font);
273 }
274 if other.opacity.is_some() {
275 self.opacity = other.opacity;
276 }
277 if other.transition.is_some() {
278 self.transition.clone_from(&other.transition);
279 }
280 if other.shadow.is_some() {
281 self.shadow.clone_from(&other.shadow);
282 }
283 if other.material.is_some() {
284 self.material.clone_from(&other.material);
285 }
286 if other.reveal.is_some() {
287 self.reveal.clone_from(&other.reveal);
288 }
289 if other.reveal_color.is_some() {
290 self.reveal_color.clone_from(&other.reveal_color);
291 }
292 if other.reveal_radius.is_some() {
293 self.reveal_radius = other.reveal_radius;
294 }
295 if other.text_case.is_some() {
296 self.text_case.clone_from(&other.text_case);
297 }
298 if other.letter_spacing.is_some() {
299 self.letter_spacing = other.letter_spacing;
300 }
301 if other.gap.is_some() {
302 self.gap = other.gap;
303 }
304 if other.border_sides.is_some() {
305 self.border_sides = other.border_sides;
306 }
307 if other.border_style.is_some() {
308 self.border_style.clone_from(&other.border_style);
309 }
310 if other.line_height.is_some() {
311 self.line_height = other.line_height;
312 }
313 if other.font_weight.is_some() {
314 self.font_weight = other.font_weight;
315 }
316 if other.font_size.is_some() {
317 self.font_size = other.font_size;
318 }
319 if other.italic.is_some() {
320 self.italic = other.italic;
321 }
322 if other.icon_size.is_some() {
323 self.icon_size = other.icon_size;
324 }
325 if other.icon_color.is_some() {
326 self.icon_color.clone_from(&other.icon_color);
327 }
328 if other.icon_gap.is_some() {
329 self.icon_gap = other.icon_gap;
330 }
331 if other.width.is_some() {
332 self.width = other.width;
333 }
334 if other.item_height.is_some() {
335 self.item_height = other.item_height;
336 }
337 if other.separator_height.is_some() {
338 self.separator_height = other.separator_height;
339 }
340 if other.thumb.is_some() {
341 self.thumb.clone_from(&other.thumb);
342 }
343 if let Some(bar) = &other.scroll_bar {
344 match &mut self.scroll_bar {
345 Some(mine) => mine.merge(bar),
346 None => self.scroll_bar = Some(bar.clone()),
347 }
348 }
349 }
350}
351
352#[derive(Clone, Debug, Default, PartialEq)]
354pub struct Style {
355 pub base: StyleProps,
356 pub hover: StyleProps,
357 pub pressed: StyleProps,
358 pub focused: StyleProps,
359 pub checked: StyleProps,
360 pub disabled: StyleProps,
361}
362
363impl Style {
364 pub fn new(base: StyleProps) -> Self {
365 Self { base, ..Default::default() }
366 }
367
368 pub fn hover(mut self, p: StyleProps) -> Self {
369 self.hover = p;
370 self
371 }
372
373 pub fn pressed(mut self, p: StyleProps) -> Self {
374 self.pressed = p;
375 self
376 }
377
378 pub fn focused(mut self, p: StyleProps) -> Self {
379 self.focused = p;
380 self
381 }
382
383 pub fn checked(mut self, p: StyleProps) -> Self {
384 self.checked = p;
385 self
386 }
387
388 pub fn disabled(mut self, p: StyleProps) -> Self {
389 self.disabled = p;
390 self
391 }
392
393 pub fn merge(&mut self, other: &Style) {
395 self.base.merge(&other.base);
396 self.hover.merge(&other.hover);
397 self.pressed.merge(&other.pressed);
398 self.focused.merge(&other.focused);
399 self.checked.merge(&other.checked);
400 self.disabled.merge(&other.disabled);
401 }
402
403 fn state(&self, index: usize) -> &StyleProps {
405 match index {
406 0 => &self.hover,
407 1 => &self.pressed,
408 2 => &self.focused,
409 3 => &self.checked,
410 _ => &self.disabled,
411 }
412 }
413}
414
415#[derive(Clone, Debug, PartialEq)]
417pub struct ResolvedStyle {
418 pub fill: Color,
419 pub text: Color,
420 pub border_color: Color,
421 pub border_width: f32,
422 pub radius: f32,
423 pub padding: Bounds,
424 pub font: FontSpec,
425 pub opacity: f32,
426 pub transition_ms: f32,
427 pub shadow: Option<Shadow>,
429 pub material: Material,
431 pub reveal: Reveal,
433 pub text_case: crate::text::TextCase,
435 pub letter_spacing: f32,
437 pub border_sides: Option<Bounds>,
439 pub border_dash: Vec<f32>,
441 pub line_height: f32,
443 pub gap: Option<f32>,
445 pub icon_size: Option<f32>,
447 pub icon_color: Option<Color>,
448 pub icon_gap: Option<f32>,
449 pub scroll_bar: Option<Box<Style>>,
451}
452
453impl ResolvedStyle {
454 pub fn border_stroke(&self, color: Color, width: f32) -> crate::canvas::Stroke {
456 let stroke = crate::canvas::Stroke::new(color, width);
457 if self.border_dash.is_empty() { stroke } else { stroke.dashed(self.border_dash.clone()) }
458 }
459}
460
461impl Default for ResolvedStyle {
462 fn default() -> Self {
463 Self {
464 fill: Color::TRANSPARENT,
465 text: Color::BLACK,
466 border_color: Color::TRANSPARENT,
467 border_width: 0.0,
468 radius: 0.0,
469 padding: Bounds::ZERO,
470 font: FontSpec::default(),
471 opacity: 1.0,
472 transition_ms: 0.0,
473 shadow: None,
474 material: Material::None,
475 reveal: Reveal::default(),
476 text_case: crate::text::TextCase::None,
477 letter_spacing: 0.0,
478 border_sides: None,
479 border_dash: Vec::new(),
480 line_height: 0.0,
481 gap: None,
482 icon_size: None,
483 icon_color: None,
484 icon_gap: None,
485 scroll_bar: None,
486 }
487 }
488}
489
490impl ResolvedStyle {
491 pub fn lerp(&self, other: &ResolvedStyle, t: f32) -> ResolvedStyle {
494 let mix = |a: f32, b: f32| a + (b - a) * t;
495 ResolvedStyle {
496 fill: self.fill.lerp(other.fill, t),
497 text: self.text.lerp(other.text, t),
498 border_color: self.border_color.lerp(other.border_color, t),
499 border_width: mix(self.border_width, other.border_width),
500 radius: mix(self.radius, other.radius),
501 padding: other.padding,
502 font: other.font.clone(),
503 opacity: mix(self.opacity, other.opacity),
504 transition_ms: other.transition_ms,
505 shadow: match (self.shadow, other.shadow) {
506 (Some(a), Some(b)) => Some(Shadow {
507 color: a.color.lerp(b.color, t),
508 blur: mix(a.blur, b.blur),
509 offset: crate::PointF::new(mix(a.offset.x, b.offset.x), mix(a.offset.y, b.offset.y)),
510 spread: mix(a.spread, b.spread),
511 }),
512 _ => other.shadow,
513 },
514 material: other.material,
515 reveal: other.reveal,
516 text_case: other.text_case,
517 letter_spacing: mix(self.letter_spacing, other.letter_spacing),
518 border_sides: other.border_sides,
519 border_dash: other.border_dash.clone(),
520 line_height: mix(self.line_height, other.line_height),
521 gap: other.gap,
522 icon_size: other.icon_size,
523 icon_color: match (self.icon_color, other.icon_color) {
524 (Some(a), Some(b)) => Some(a.lerp(b, t)),
525 _ => other.icon_color,
526 },
527 icon_gap: other.icon_gap,
528 scroll_bar: other.scroll_bar.clone(),
529 }
530 }
531}
532
533#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
537pub enum Look {
538 #[default]
540 Aylis,
541 Material2,
543 Material3,
545 Ios7,
547 Ios13,
549 Ios26,
551 Win7,
553 Win10,
555 Win11,
557 WinPhone,
559}
560
561impl crate::prop::PropEnum for Look {
562 const NAMES: &'static [&'static str] = &["aylis", "material2", "material3", "ios7", "ios13", "ios26", "win7", "win10", "win11", "winphone"];
563
564 fn from_index(index: usize) -> Option<Self> {
565 [
566 Look::Aylis,
567 Look::Material2,
568 Look::Material3,
569 Look::Ios7,
570 Look::Ios13,
571 Look::Ios26,
572 Look::Win7,
573 Look::Win10,
574 Look::Win11,
575 Look::WinPhone,
576 ]
577 .get(index)
578 .copied()
579 }
580
581 fn index(self) -> usize {
582 self as usize
583 }
584}
585
586impl Look {
587 pub fn is_material(self) -> bool {
588 matches!(self, Look::Material2 | Look::Material3)
589 }
590
591 pub fn is_ios(self) -> bool {
592 matches!(self, Look::Ios7 | Look::Ios13 | Look::Ios26)
593 }
594
595 pub fn is_windows(self) -> bool {
596 matches!(self, Look::Win7 | Look::Win10 | Look::Win11 | Look::WinPhone)
597 }
598}
599
600#[derive(Clone, Debug, Default, PartialEq)]
602pub struct Theme {
603 pub name: String,
604 pub family: String,
607 pub dark: bool,
609 pub look: Look,
611 pub colors: HashMap<String, Color>,
612 pub fonts: HashMap<String, FontSpec>,
613 pub radius: HashMap<String, f32>,
614 pub spacing: HashMap<String, f32>,
615 pub durations: HashMap<String, f32>,
617 pub shadows: HashMap<String, Shadow>,
618 pub styles: HashMap<String, Style>,
620 pub components: HashMap<String, String>,
622}
623
624impl Theme {
625 pub fn apply_font_family(&mut self, family: &str) {
628 if family.is_empty() {
629 return;
630 }
631 for font in self.fonts.values_mut() {
632 if font.family != "monospace" && !font.family.to_lowercase().contains("mono") {
633 font.family = family.to_string();
634 }
635 }
636 }
637
638 pub fn new(name: impl Into<String>) -> Self {
639 Self { name: name.into(), ..Default::default() }
640 }
641
642 pub fn light() -> Self {
644 let mut t = Theme::new("Aylis Light");
645 t.family = "Aylis".into();
646 t.set_colors(&[
647 ("background", "#F5F5F7"),
648 ("surface", "#FFFFFF"),
649 ("text", "#1F2328"),
650 ("text_muted", "#6B7280"),
651 ("border", "#D0D7DE"),
652 ("primary", "#2563EB"),
653 ("primary_hover", "#3B82F6"),
654 ("primary_pressed", "#1D4ED8"),
655 ("on_primary", "#FFFFFF"),
656 ("on_danger", "#FFFFFF"),
658 ("on_success", "#FFFFFF"),
659 ("danger", "#DC2626"),
660 ("danger_hover", "#EF4444"),
661 ("danger_pressed", "#B91C1C"),
662 ("success", "#16A34A"),
663 ("warning", "#D97706"),
664 ("focus_ring", "#3B82F6"),
665 ("accent", "#9333EA"),
666 ("hover_overlay", "#0000000F"),
667 ("glass_fill", "#FFFFFF73"),
668 ("primary_container", "#DBEAFE"),
669 ("on_primary_container", "#1E3A8A"),
670 ("selection", "#2563EB40"),
671 ("track", "#D0D7DE"),
672 ("surface_2", "#F0F1F4"),
673 ("info", "#0284C7"),
674 ("primary_soft", "#2563EB1A"),
675 ("success_soft", "#16A34A1A"),
676 ("warning_soft", "#D977061F"),
677 ("danger_soft", "#DC26261A"),
678 ("info_soft", "#0284C71A"),
679 ("meter_low", "#16A34A"),
680 ("meter_mid", "#EAB308"),
681 ("meter_high", "#DC2626"),
682 ("presence_online", "#16A34A"),
683 ("presence_away", "#EAB308"),
684 ("presence_busy", "#DC2626"),
685 ("presence_offline", "#9CA3AF"),
686 ]);
687 t.shadows.insert("sm".into(), Shadow::new(Color::rgba(15, 23, 42, 20), 4.0, 0.0, 1.0));
688 t.shadows.insert("md".into(), Shadow::new(Color::rgba(15, 23, 42, 28), 12.0, 0.0, 4.0));
689 t.shadows.insert("lg".into(), Shadow::new(Color::rgba(15, 23, 42, 36), 28.0, 0.0, 10.0));
690 t.shadows.insert("2xl".into(), Shadow::new(Color::rgba(15, 23, 42, 64), 50.0, 0.0, 25.0));
692 t.add_standard_tokens();
693 t.add_standard_styles();
694 t
695 }
696
697 pub fn dark() -> Self {
699 let mut t = Theme::new("Aylis Dark");
700 t.family = "Aylis".into();
701 t.dark = true;
702 t.set_colors(&[
703 ("background", "#1E1E1E"),
704 ("surface", "#252526"),
705 ("text", "#E6E6E6"),
706 ("text_muted", "#9A9A9A"),
707 ("border", "#3C3C3C"),
708 ("primary", "#3B82F6"),
709 ("primary_hover", "#60A5FA"),
710 ("primary_pressed", "#2563EB"),
711 ("on_primary", "#FFFFFF"),
712 ("on_danger", "#FFFFFF"),
714 ("on_success", "#FFFFFF"),
715 ("danger", "#EF4444"),
716 ("danger_hover", "#F87171"),
717 ("danger_pressed", "#DC2626"),
718 ("success", "#22C55E"),
719 ("warning", "#F59E0B"),
720 ("focus_ring", "#60A5FA"),
721 ("accent", "#A855F7"),
722 ("hover_overlay", "#FFFFFF14"),
723 ("glass_fill", "#1E1E2273"),
724 ("primary_container", "#1E3A8A"),
725 ("on_primary_container", "#DBEAFE"),
726 ("selection", "#3B82F660"),
727 ("track", "#4A4A4F"),
728 ("surface_2", "#2D2D30"),
729 ("info", "#38BDF8"),
730 ("primary_soft", "#3B82F62E"),
731 ("success_soft", "#22C55E29"),
732 ("warning_soft", "#F59E0B29"),
733 ("danger_soft", "#EF444429"),
734 ("info_soft", "#38BDF829"),
735 ("meter_low", "#22C55E"),
736 ("meter_mid", "#FACC15"),
737 ("meter_high", "#EF4444"),
738 ("presence_online", "#22C55E"),
739 ("presence_away", "#FACC15"),
740 ("presence_busy", "#EF4444"),
741 ("presence_offline", "#6B7280"),
742 ]);
743 t.shadows.insert("sm".into(), Shadow::new(Color::rgba(0, 0, 0, 70), 4.0, 0.0, 1.0));
744 t.shadows.insert("md".into(), Shadow::new(Color::rgba(0, 0, 0, 90), 14.0, 0.0, 4.0));
745 t.shadows.insert("lg".into(), Shadow::new(Color::rgba(0, 0, 0, 110), 30.0, 0.0, 10.0));
746 t.shadows.insert("2xl".into(), Shadow::new(Color::rgba(0, 0, 0, 150), 50.0, 0.0, 25.0));
747 t.add_standard_tokens();
748 t.add_standard_styles();
749 t
750 }
751
752 fn set_colors(&mut self, colors: &[(&str, &str)]) {
753 for (name, hex) in colors {
754 let color = Color::from_hex(hex).expect("cor inválida no tema padrão");
755 self.colors.insert(name.to_string(), color);
756 }
757 }
758
759 fn add_standard_tokens(&mut self) {
760 self.fonts.insert("default".into(), FontSpec::new("", 14.0));
761 self.fonts.insert("title".into(), FontSpec::new("", 20.0).weight(FontWeight::Bold));
762 self.fonts.insert("heading".into(), FontSpec::new("", 16.0).weight(FontWeight::SemiBold));
763 self.fonts.insert("small".into(), FontSpec::new("", 12.0));
764 self.fonts.insert("strong".into(), FontSpec::new("", 14.0).weight(FontWeight::SemiBold));
765 self.fonts.insert("mono".into(), FontSpec::new("monospace", 13.0));
766 for (k, v) in [("sm", 4.0), ("md", 6.0), ("lg", 10.0)] {
767 self.radius.insert(k.into(), v);
768 }
769 for (k, v) in [("xs", 4.0), ("sm", 8.0), ("md", 12.0), ("lg", 16.0)] {
770 self.spacing.insert(k.into(), v);
771 }
772 for (k, v) in [("fast", 120.0), ("normal", 200.0), ("slow", 350.0)] {
773 self.durations.insert(k.into(), v);
774 }
775 }
776
777 fn add_standard_styles(&mut self) {
778 self.set_style("Form", Style::new(StyleProps::new().fill("background").text("text")));
779 self.set_style(
780 "Panel",
781 Style::new(StyleProps::new().fill("surface").border("border", 1.0).radius("sm")),
782 );
783 self.set_style("Label", Style::new(StyleProps::new().text("text")));
784 self.set_style(
785 "Button",
786 Style::new(
787 StyleProps::new()
788 .fill("primary")
789 .text("on_primary")
790 .radius("md")
791 .padding((12.0, 6.0))
792 .transition("fast"),
793 )
794 .hover(StyleProps::new().fill("primary_hover"))
795 .pressed(StyleProps::new().fill("primary_pressed"))
796 .focused(StyleProps::new().border("focus_ring", 2.0))
797 .disabled(StyleProps::new().opacity(0.5)),
798 );
799 self.set_style(
800 "Button.danger",
801 Style::new(StyleProps::new().fill("danger").text("on_danger"))
802 .hover(StyleProps::new().fill("danger_hover"))
803 .pressed(StyleProps::new().fill("danger_pressed")),
804 );
805 self.set_style(
807 "Button.round",
808 Style::new(StyleProps::new().fill("primary").text("on_primary").radius(999.0).border(Color::TRANSPARENT, 0.0))
809 .hover(StyleProps::new().fill("primary_hover"))
810 .pressed(StyleProps::new().fill("primary_pressed")),
811 );
812 self.set_style(
813 "Button.flat",
814 Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("primary"))
815 .hover(StyleProps::new().fill("hover_overlay"))
816 .pressed(StyleProps::new().fill("hover_overlay")),
817 );
818 self.set_style(
819 "Edit",
820 Style::new(
821 StyleProps::new()
822 .fill("surface")
823 .text("text")
824 .border("border", 1.0)
825 .radius("sm")
826 .padding((8.0, 4.0)),
827 )
828 .hover(StyleProps::new().border("text_muted", 1.0))
829 .focused(StyleProps::new().border("focus_ring", 2.0))
830 .disabled(StyleProps::new().opacity(0.5)),
831 );
832 self.set_style(
833 "ComboBox",
834 Style::new(
835 StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("sm").padding((8.0, 4.0)),
836 )
837 .hover(StyleProps::new().border("text_muted", 1.0))
838 .focused(StyleProps::new().border("focus_ring", 2.0))
839 .disabled(StyleProps::new().opacity(0.5)),
840 );
841 for class in ["CheckBox", "RadioButton"] {
843 self.set_style(
844 class,
845 Style::new(
846 StyleProps::new().fill("surface").text("text").border("text_muted", 1.5).radius("sm").transition("fast"),
847 )
848 .hover(StyleProps::new().border("primary", 1.5))
849 .checked(StyleProps::new().fill("primary").border("primary", 1.5))
850 .focused(StyleProps::new().border("focus_ring", 2.0))
851 .disabled(StyleProps::new().opacity(0.5)),
852 );
853 }
854 self.set_style(
856 "Switch",
857 Style::new(StyleProps::new().fill("track").text("text").transition("normal"))
858 .checked(StyleProps::new().fill("primary"))
859 .focused(StyleProps::new().border("focus_ring", 2.0))
860 .disabled(StyleProps::new().opacity(0.5)),
861 );
862 self.set_style("ProgressBar", Style::new(StyleProps::new().fill("track").radius(4.0)));
864 for class in ["Memo", "ListBox", "ListView", "TreeView", "Calendar"] {
866 self.set_style(
867 class,
868 Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("sm").padding((6.0, 4.0)))
869 .focused(StyleProps::new().border("focus_ring", 2.0))
870 .disabled(StyleProps::new().opacity(0.5)),
871 );
872 self.set_style(
875 &format!("{class}.flat"),
876 Style::new(StyleProps::new().border(Color::TRANSPARENT, 0.0))
877 .focused(StyleProps::new().border(Color::TRANSPARENT, 0.0)),
878 );
879 }
880 self.set_style(
883 "CodeEditor",
884 Style::new(StyleProps::new().fill("surface").text("text").border(Color::TRANSPARENT, 0.0).radius(0.0).padding((4.0, 2.0)))
885 .focused(StyleProps::new().border(Color::TRANSPARENT, 0.0))
886 .disabled(StyleProps::new().opacity(0.5)),
887 );
888 self.set_style("TabStrip", Style::new(StyleProps::new().fill("surface_2").text("text").border(Color::TRANSPARENT, 0.0)));
891 self.set_style(
893 "TrackBar",
894 Style::new(StyleProps::new().fill("track").text("text").radius(3.0))
895 .focused(StyleProps::new().border("focus_ring", 2.0))
896 .disabled(StyleProps::new().opacity(0.5)),
897 );
898 self.set_style("GroupBox", Style::new(StyleProps::new().text("text").border("border", 1.0).radius("md")));
899 self.set_style("Expander", Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("md")));
900 self.set_style("TabControl", Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("md")));
901 self.set_style("TabItem", Style::new(StyleProps::new().text("text")));
902 self.set_style("StatusBar", Style::new(StyleProps::new().fill("surface").text("text_muted").border("border", 1.0)));
903 self.set_style("ToolBar", Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0)));
904 self.set_style("RadioGroup", Style::new(StyleProps::new().text("text").border("border", 1.0).radius("md")));
905 self.set_style("Chart", Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("md")));
906 self.add_variant_styles();
907 }
908
909 fn add_variant_styles(&mut self) {
911 self.set_style(
913 "Button.secondary",
914 Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0))
915 .hover(StyleProps::new().fill("surface_2").border("text_muted", 1.0))
916 .pressed(StyleProps::new().fill("track")),
917 );
918 self.set_style(
919 "Button.outline",
920 Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("primary").border("primary", 1.0))
921 .hover(StyleProps::new().fill("primary_soft"))
922 .pressed(StyleProps::new().fill("primary_soft")),
923 );
924 self.set_style(
925 "Button.success",
926 Style::new(StyleProps::new().fill("success").text("on_success"))
927 .hover(StyleProps::new().opacity(0.9))
928 .pressed(StyleProps::new().opacity(0.8)),
929 );
930 self.set_style(
932 "Button.positive",
933 Style::new(StyleProps::new().fill("success").text("on_success")).hover(StyleProps::new().opacity(0.9)).pressed(StyleProps::new().opacity(0.8)),
934 );
935 self.set_style(
936 "Button.negative",
937 Style::new(StyleProps::new().fill("danger").text("on_danger")).hover(StyleProps::new().fill("danger_hover")).pressed(StyleProps::new().fill("danger_pressed")),
938 );
939 self.set_style(
940 "Button.accent",
941 Style::new(StyleProps::new().fill("accent").text("on_primary")).hover(StyleProps::new().opacity(0.9)).pressed(StyleProps::new().opacity(0.8)),
942 );
943 self.set_style("Button.rounded", Style::new(StyleProps::new().radius(28.0)));
944 self.set_style("Button.unelevated", Style::new(StyleProps::new().shadow("none")));
945 self.set_style(
946 "Button.push",
947 Style::new(StyleProps::new().border(Color::rgba(0, 0, 0, 0x40), 3.0)).pressed(StyleProps::new().fill("primary_pressed").border(Color::rgba(0, 0, 0, 0x40), 1.0)),
948 );
949 self.set_style("Button.glossy", Style::new(StyleProps::new().fill("primary_hover").shadow("md")).hover(StyleProps::new().fill("primary")));
950 self.set_style(
951 "Button.icon",
952 Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("text").padding(6.0).radius("md"))
953 .hover(StyleProps::new().fill("hover_overlay"))
954 .pressed(StyleProps::new().fill("track"))
955 .checked(StyleProps::new().fill("primary_soft").text("primary")),
956 );
957 self.set_style(
958 "Button.fab",
959 Style::new(StyleProps::new().fill("primary").text("on_primary").radius(999.0).shadow("md").padding(10.0))
960 .hover(StyleProps::new().fill("primary_hover").shadow("lg"))
961 .pressed(StyleProps::new().fill("primary_pressed").shadow("sm")),
962 );
963 self.set_style(
964 "Button.link",
965 Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("primary").padding((2.0, 2.0)))
966 .hover(StyleProps::new().fill(Color::TRANSPARENT).text("primary_hover"))
967 .pressed(StyleProps::new().fill(Color::TRANSPARENT).text("primary_pressed")),
968 );
969 self.set_style(
970 "Button.pill",
971 Style::new(StyleProps::new().fill("surface_2").text("text").radius(999.0).padding((14.0, 6.0)))
972 .hover(StyleProps::new().fill("track"))
973 .checked(StyleProps::new().fill("primary").text("on_primary")),
974 );
975 self.set_style(
978 "Button.elevated",
979 Style::new(StyleProps::new().fill("surface").text("primary").radius(999.0).shadow("sm"))
980 .hover(StyleProps::new().shadow("md"))
981 .pressed(StyleProps::new().fill("surface_2")),
982 );
983 self.set_style(
984 "Button.tonal",
985 Style::new(StyleProps::new().fill("primary_soft").text("primary").border(Color::TRANSPARENT, 0.0).radius(999.0))
986 .hover(StyleProps::new().shadow("sm")),
987 );
988 self.set_style(
989 "Button.text",
990 Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("primary").border(Color::TRANSPARENT, 0.0).shadow("none"))
991 .hover(StyleProps::new().fill("primary_soft")),
992 );
993 self.set_style(
994 "Button.fab_extended",
995 Style::new(StyleProps::new().fill("primary_container").text("on_primary_container").radius(16.0).shadow("md").padding((16.0, 0.0)))
996 .hover(StyleProps::new().shadow("lg")),
997 );
998 self.set_style(
999 "Button.icon_filled",
1000 Style::new(StyleProps::new().fill("primary").text("on_primary").radius(999.0).padding(6.0)).hover(StyleProps::new().fill("primary_hover")),
1001 );
1002 self.set_style(
1003 "Button.icon_tonal",
1004 Style::new(StyleProps::new().fill("primary_soft").text("primary").radius(999.0).padding(6.0)).hover(StyleProps::new().shadow("sm")),
1005 );
1006 self.set_style(
1007 "Button.icon_outlined",
1008 Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("text").border("border", 1.0).radius(999.0).padding(6.0))
1009 .hover(StyleProps::new().fill("hover_overlay")),
1010 );
1011 self.set_style(
1012 "Button.glass",
1013 Style::new(StyleProps::new().fill("glass_fill").text("text").border(Color::TRANSPARENT, 0.0).radius(999.0).shadow("sm").material("glass"))
1014 .pressed(StyleProps::new().opacity(0.8)),
1015 );
1016 self.set_style(
1017 "Button.glass_prominent",
1018 Style::new(StyleProps::new().fill("primary").text("on_primary").border(Color::TRANSPARENT, 0.0).radius(999.0).shadow("sm").material("glass"))
1019 .pressed(StyleProps::new().opacity(0.85)),
1020 );
1021 self.set_style(
1023 "Edit.filled",
1024 Style::new(StyleProps::new().fill("surface_2").border(Color::TRANSPARENT, 0.0).radius(4.0).padding((14.0, 4.0)))
1025 .hover(StyleProps::new().fill("track")),
1026 );
1027 self.set_style(
1028 "Edit.outlined",
1029 Style::new(StyleProps::new().fill(Color::TRANSPARENT).border("border", 1.0).radius(4.0).padding((14.0, 4.0)))
1030 .focused(StyleProps::new().border("primary", 2.0)),
1031 );
1032 let outlined = self.styles["Edit.outlined"].clone();
1034 self.set_style("ComboBox.outlined", outlined);
1035 self.set_style(
1036 "Edit.search",
1037 Style::new(StyleProps::new().fill("surface_2").border(Color::TRANSPARENT, 1.0).radius(999.0).padding((12.0, 4.0)))
1038 .hover(StyleProps::new().border("border", 1.0))
1039 .focused(StyleProps::new().fill("surface").border("focus_ring", 2.0)),
1040 );
1041 self.set_style(
1042 "Edit.flat",
1043 Style::new(StyleProps::new().fill(Color::TRANSPARENT).border(Color::TRANSPARENT, 0.0).radius(0.0))
1044 .hover(StyleProps::new().fill("hover_overlay").border(Color::TRANSPARENT, 0.0))
1045 .focused(StyleProps::new().border(Color::TRANSPARENT, 0.0)),
1046 );
1047 self.set_style("Panel.card", Style::new(StyleProps::new().fill("surface").border("border", 1.0).radius("lg").shadow("sm")));
1049 self.set_style("Card", Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("lg").shadow("sm")));
1051 self.set_style("Popover", Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("md").shadow("lg").padding(12.0)));
1052 self.set_style("Card.flat", Style::new(StyleProps::new().shadow("none")));
1053 self.set_style("Card.bordered", Style::new(StyleProps::new().border("border", 1.0).shadow("none")));
1054 self.set_style("Panel.flat", Style::new(StyleProps::new().fill("surface").border(Color::TRANSPARENT, 0.0).radius(0.0)));
1055 self.set_style("Panel.sidebar", Style::new(StyleProps::new().fill("surface_2").border("border", 1.0).radius(0.0)));
1056 self.set_style("Panel.overlay", Style::new(StyleProps::new().fill("surface").border("border", 1.0).radius("lg").shadow("lg")));
1057 self.set_style("Panel.filled", Style::new(StyleProps::new().fill("surface_2").border(Color::TRANSPARENT, 0.0).radius("lg").shadow("none")));
1058 self.set_style("Panel.outlined", Style::new(StyleProps::new().fill("surface").border("border", 1.0).radius("lg").shadow("none")));
1059 self.set_style("Panel.glass", Style::new(StyleProps::new().fill("glass_fill").border(Color::TRANSPARENT, 0.0).radius("lg").shadow("md").material("glass")));
1060 self.set_style("Button.reveal", Style::new(StyleProps::new().reveal("both")));
1062 self.set_style("Panel.reveal", Style::new(StyleProps::new().border("border", 1.0).reveal("border")));
1063 self.set_style("ToolBar.floating", Style::new(StyleProps::new().fill("surface_2").border(Color::TRANSPARENT, 0.0).radius(999.0).shadow("md").padding(6.0)));
1064 self.set_style("Label.title", Style::new(StyleProps::new().font("title")));
1066 self.set_style("Label.heading", Style::new(StyleProps::new().font("heading")));
1067 self.set_style("Label.muted", Style::new(StyleProps::new().text("text_muted")));
1068 self.set_style("Label.caption", Style::new(StyleProps::new().text("text_muted").font("small")));
1069 self.set_style("Label.mono", Style::new(StyleProps::new().font("mono")));
1070 self.set_style(
1072 "Label.kbd",
1073 Style::new(StyleProps::new().font("mono").fill("surface_2").border("border", 1.0).radius(4.0).padding((6.0, 1.0))),
1074 );
1075 self.set_style("Label.link", Style::new(StyleProps::new().text("primary")).hover(StyleProps::new().text("primary_hover")));
1076 self.set_style("Label.error", Style::new(StyleProps::new().text("danger").font("small")));
1077 self.set_style("ProgressBar.thin", Style::new(StyleProps::new().radius(2.0)));
1079 self.set_style("ProgressBar.success", Style::new(StyleProps::new().text("success")));
1080 self.set_style("ProgressBar.danger", Style::new(StyleProps::new().text("danger")));
1081 self.set_style("Switch.success", Style::new(StyleProps::new()).checked(StyleProps::new().fill("success")));
1083 self.set_style("CheckBox.round", Style::new(StyleProps::new().radius(999.0)));
1084 self.set_style("Icon", Style::new(StyleProps::new().text("text")));
1086 let hint = if self.dark {
1090 StyleProps::new().fill("surface_2").text("text").border("border", 1.0)
1091 } else {
1092 StyleProps::new().fill("text").text("surface")
1093 };
1094 self.set_style("Hint", Style::new(hint.radius("sm").padding((8.0, 5.0)).font("small").shadow("md")));
1095 self.set_style("Icon.muted", Style::new(StyleProps::new().text("text_muted")));
1096 self.set_style("Badge", Style::new(StyleProps::new().fill("surface_2").text("text_muted").radius(999.0).padding((8.0, 2.0)).font("small")));
1097 for tone in ["primary", "success", "warning", "danger", "info"] {
1098 self.set_style(&format!("Badge.{tone}"), Style::new(StyleProps::new().fill(format!("{tone}_soft").as_str()).text(tone)));
1099 }
1100 self.set_style("Badge.live", Style::new(StyleProps::new().fill("danger").text("on_primary").font("strong")));
1101 self.set_style("Badge.outline", Style::new(StyleProps::new().fill(Color::TRANSPARENT).text("text").border("border", 1.0)));
1102 self.set_style("Banner", Style::new(StyleProps::new().text("text").radius("md").padding((12.0, 10.0))));
1103 self.set_style(
1104 "SegmentedControl",
1105 Style::new(StyleProps::new().fill("surface_2").text("text").radius("md").transition("fast")).disabled(StyleProps::new().opacity(0.5)),
1106 );
1107 self.set_style("LevelMeter", Style::new(StyleProps::new().fill("track").radius(2.0)));
1108 self.set_style(
1109 "HotkeyEdit",
1110 Style::new(StyleProps::new().fill("surface").text("text").border("border", 1.0).radius("sm").padding((8.0, 4.0)))
1111 .hover(StyleProps::new().border("text_muted", 1.0))
1112 .focused(StyleProps::new().border("focus_ring", 2.0))
1113 .disabled(StyleProps::new().opacity(0.5)),
1114 );
1115 self.set_style("SeekBar", Style::new(StyleProps::new().text("text")).disabled(StyleProps::new().opacity(0.5)));
1116 self.set_style("NodeGraph", Style::new(StyleProps::new().fill("background").text("text").border("border", 1.0).radius("lg")));
1117 self.set_style("ChatView", Style::new(StyleProps::new().fill("background").text("text")));
1118 self.set_style("DirectionPad", Style::new(StyleProps::new().text("text")).disabled(StyleProps::new().opacity(0.5)));
1119 }
1120
1121 pub fn set_style(&mut self, key: &str, style: Style) {
1122 self.styles.insert(key.to_string(), style);
1123 }
1124
1125 pub fn family_name(&self) -> &str {
1127 if self.family.is_empty() { &self.name } else { &self.family }
1128 }
1129
1130 pub fn mix(&mut self, class: &str, theme: &str) {
1133 if theme.is_empty() {
1134 self.components.remove(class);
1135 } else {
1136 self.components.insert(class.to_string(), theme.to_string());
1137 }
1138 }
1139
1140 pub fn mixed_for(&self, classes: &[&str]) -> Option<&str> {
1143 if self.components.is_empty() {
1144 return None;
1145 }
1146 classes.iter().find_map(|c| self.components.get(*c).map(String::as_str))
1147 }
1148
1149 pub fn variants_of(&self, class: &str) -> Vec<String> {
1151 let prefix = format!("{class}.");
1152 let mut v: Vec<String> = self.styles.keys().filter_map(|k| k.strip_prefix(&prefix).map(str::to_string)).collect();
1153 v.sort();
1154 v
1155 }
1156
1157 pub fn style(&self, key: &str) -> Option<&Style> {
1158 self.styles.get(key)
1159 }
1160
1161 pub fn color(&self, token: &str) -> Color {
1164 self.colors.get(token).copied().or_else(|| self.resolve_color(token)).unwrap_or(Color::TRANSPARENT)
1165 }
1166
1167 pub fn color_of(&self, c: &ColorRef) -> Color {
1168 match c {
1169 ColorRef::Value(v) => *v,
1170 ColorRef::Token(t) => self.color(t),
1171 }
1172 }
1173
1174 fn metric(map: &HashMap<String, f32>, m: &Metric) -> f32 {
1175 match m {
1176 Metric::Value(v) => *v,
1177 Metric::Token(t) => map.get(t).copied().unwrap_or(0.0),
1178 }
1179 }
1180
1181 pub fn reach(&self, classes: &[&str], variant: &str) -> f32 {
1188 let mut reach: f32 = 0.0;
1189 let mut add = |s: &Style| {
1190 for props in [&s.base, &s.hover, &s.pressed, &s.focused, &s.checked, &s.disabled] {
1191 if let Some(shadow) = props.shadow.as_deref().and_then(|t| self.shadows.get(t)) {
1192 reach = reach.max(shadow.reach());
1193 }
1194 }
1195 };
1196 for class in classes {
1197 if let Some(s) = self.styles.get(*class) {
1198 add(s);
1199 }
1200 if !variant.is_empty() {
1201 if let Some(s) = self.styles.get(&format!("{class}.{variant}")) {
1202 add(s);
1203 }
1204 }
1205 }
1206 reach
1207 }
1208
1209 pub fn resolve(&self, classes: &[&str], variant: &str, state: ControlState) -> ResolvedStyle {
1210 let mut layers: Vec<&Style> = Vec::new();
1211 for class in classes.iter().rev() {
1212 if let Some(s) = self.styles.get(*class) {
1213 layers.push(s);
1214 }
1215 if !variant.is_empty() {
1216 if let Some(s) = self.styles.get(&format!("{class}.{variant}")) {
1217 layers.push(s);
1218 }
1219 }
1220 }
1221
1222 let mut acc = StyleProps::default();
1223 for s in &layers {
1224 acc.merge(&s.base);
1225 }
1226 let active = [state.hover, state.pressed, state.focused, state.checked, state.disabled];
1227 let checked_as_pressed = state.checked && layers.iter().all(|s| s.checked == StyleProps::default());
1230 for (i, on) in active.into_iter().enumerate() {
1231 if on {
1232 for s in &layers {
1233 acc.merge(s.state(if i == 3 && checked_as_pressed { 1 } else { i }));
1234 }
1235 }
1236 }
1237
1238 let defaults = ResolvedStyle::default();
1239 ResolvedStyle {
1240 fill: acc.fill.as_ref().map_or(defaults.fill, |c| self.color_of(c)),
1241 text: acc
1242 .text
1243 .as_ref()
1244 .map(|c| self.color_of(c))
1245 .or_else(|| self.colors.get("text").copied())
1246 .unwrap_or(defaults.text),
1247 border_color: acc.border_color.as_ref().map_or(defaults.border_color, |c| self.color_of(c)),
1248 border_width: acc.border_width.unwrap_or(defaults.border_width),
1249 radius: acc.radius.as_ref().map_or(0.0, |m| Self::metric(&self.radius, m)),
1250 padding: acc.padding.unwrap_or(defaults.padding),
1251 font: {
1252 let mut font = self.fonts.get(acc.font.as_deref().unwrap_or("default")).cloned().unwrap_or(defaults.font);
1253 if let Some(w) = acc.font_weight {
1254 font.weight = w;
1255 }
1256 if let Some(size) = acc.font_size {
1257 font.size = size;
1258 }
1259 if let Some(italic) = acc.italic {
1260 font.italic = italic;
1261 }
1262 font
1263 },
1264 line_height: acc.line_height.unwrap_or(0.0),
1265 opacity: acc.opacity.unwrap_or(1.0),
1266 transition_ms: acc.transition.as_ref().map_or(0.0, |m| Self::metric(&self.durations, m)),
1267 shadow: acc.shadow.as_deref().and_then(|t| self.shadows.get(t)).copied(),
1268 material: acc.material.as_deref().map_or(Material::None, Material::parse),
1269 reveal: {
1270 let (border, background) = match acc.reveal.as_deref() {
1271 Some("border") => (true, false),
1272 Some("background") => (false, true),
1273 Some("both") => (true, true),
1274 _ => (false, false),
1275 };
1276 let color = acc
1277 .reveal_color
1278 .as_ref()
1279 .map(|c| self.color_of(c))
1280 .or_else(|| self.colors.get("reveal").copied())
1281 .unwrap_or(if self.dark { Color::rgba(255, 255, 255, 90) } else { Color::rgba(0, 0, 0, 56) });
1282 Reveal { border, background, color, radius: acc.reveal_radius.unwrap_or(96.0).max(0.0) }
1283 },
1284 text_case: match acc.text_case.as_deref() {
1285 Some("upper") => crate::text::TextCase::Upper,
1286 Some("lower") => crate::text::TextCase::Lower,
1287 _ => crate::text::TextCase::None,
1288 },
1289 letter_spacing: acc.letter_spacing.unwrap_or(0.0),
1290 gap: acc.gap,
1291 border_sides: acc.border_sides,
1292 border_dash: match acc.border_style.as_deref() {
1293 Some("dashed") => vec![6.0, 4.0],
1294 Some("dotted") => vec![1.5, 3.0],
1295 _ => Vec::new(),
1296 },
1297 icon_size: acc.icon_size,
1298 icon_color: acc.icon_color.as_ref().map(|c| self.color_of(c)),
1299 icon_gap: acc.icon_gap,
1300 scroll_bar: acc.scroll_bar,
1301 }
1302 }
1303
1304 pub fn menu_metrics(&self) -> MenuMetrics {
1308 let Some(style) = self.styles.get("PopupMenu") else { return MenuMetrics::default() };
1309 let p = &style.base;
1310 let positive = |v: Option<f32>| v.filter(|v| *v > 0.0);
1311 MenuMetrics { width: positive(p.width), item_height: positive(p.item_height), separator_height: p.separator_height.map(|v| v.max(0.0)) }
1312 }
1313
1314 pub fn scroll_bar(&self, own: Option<&Style>, hover: bool) -> ScrollBarLook {
1319 let mut acc = StyleProps::default();
1320 let layers = [self.styles.get("ScrollBar"), own];
1321 for s in layers.iter().flatten() {
1322 acc.merge(&s.base);
1323 }
1324 if hover {
1325 for s in layers.iter().flatten() {
1326 acc.merge(&s.hover);
1327 }
1328 }
1329 ScrollBarLook {
1330 width: acc.width.map(|w| w.max(0.0)),
1331 track: acc.fill.as_ref().map(|c| self.color_of(c)),
1332 thumb: acc.thumb.as_ref().map(|c| self.color_of(c)),
1333 radius: acc.radius.as_ref().map(|m| Self::metric(&self.radius, m)),
1334 }
1335 }
1336}
1337
1338#[derive(Clone, Copy, Debug, Default, PartialEq)]
1340pub struct MenuMetrics {
1341 pub width: Option<f32>,
1343 pub item_height: Option<f32>,
1345 pub separator_height: Option<f32>,
1347}
1348
1349#[derive(Clone, Copy, Debug, Default, PartialEq)]
1351pub struct ScrollBarLook {
1352 pub width: Option<f32>,
1354 pub track: Option<Color>,
1356 pub thumb: Option<Color>,
1358 pub radius: Option<f32>,
1360}