1use crate::{BrandPalette, ElevationScale};
2
3impl Default for ThemeOptions {
4 fn default() -> Self {
5 Self {
6 density: Density::Default,
7 direction: Direction::Ltr,
8 brand: None,
9 elevation: ElevationScale::default(),
10 }
11 }
12}
13
14#[derive(Clone, Debug)]
15pub struct ThemeOptions {
16 pub density: Density,
17 pub direction: Direction,
18 pub brand: Option<BrandPalette>,
19 pub elevation: ElevationScale,
20}
21
22#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
23pub enum Density {
24 Compact,
25 #[default]
26 Default,
27 Spacious,
28}
29
30impl Density {
31 pub fn spacing_multiplier(self) -> f32 {
32 match self {
33 Self::Compact => 0.875,
34 Self::Default => 1.0,
35 Self::Spacious => 1.125,
36 }
37 }
38
39 pub fn font_size_multiplier(self) -> f32 {
40 match self {
41 Self::Compact => 0.9375,
42 Self::Default => 1.0,
43 Self::Spacious => 1.0625,
44 }
45 }
46}
47
48#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
49pub enum Direction {
50 #[default]
51 Ltr,
52 Rtl,
53}
54
55impl Direction {
56 pub fn as_str(self) -> &'static str {
57 match self {
58 Self::Ltr => "ltr",
59 Self::Rtl => "rtl",
60 }
61 }
62}