1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6pub enum Size {
7 Xs,
8 Sm,
9 Md,
10 Lg,
11 Xl,
12}
13
14impl Default for Size {
15 fn default() -> Self {
16 Size::Md
17 }
18}
19
20#[derive(Debug, Clone, Copy)]
22pub struct Scale {
23 pub xs: f32,
24 pub sm: f32,
25 pub md: f32,
26 pub lg: f32,
27 pub xl: f32,
28}
29
30impl Scale {
31 pub const fn new(xs: f32, sm: f32, md: f32, lg: f32, xl: f32) -> Self {
32 Scale { xs, sm, md, lg, xl }
33 }
34
35 pub fn get(&self, size: Size) -> f32 {
37 match size {
38 Size::Xs => self.xs,
39 Size::Sm => self.sm,
40 Size::Md => self.md,
41 Size::Lg => self.lg,
42 Size::Xl => self.xl,
43 }
44 }
45
46 pub fn spacing() -> Self {
47 Scale::new(10.0, 12.0, 16.0, 20.0, 32.0)
48 }
49
50 pub fn radius() -> Self {
51 Scale::new(2.0, 4.0, 8.0, 16.0, 32.0)
52 }
53
54 pub fn font_size() -> Self {
55 Scale::new(12.0, 14.0, 16.0, 18.0, 20.0)
56 }
57}