1use crate::geom::{Css, Rgba};
7
8#[derive(Clone, Copy, Debug, PartialEq)]
20pub struct Theme {
21 pub background: Rgba,
23 pub text: Rgba,
25 pub grid: Rgba,
27 pub axis_line: Rgba,
29 pub up: Rgba,
31 pub down: Rgba,
33 pub up_wick: Rgba,
35 pub down_wick: Rgba,
37 pub volume_up: Rgba,
39 pub volume_down: Rgba,
41 pub crosshair: Rgba,
43 pub crosshair_label_bg: Rgba,
45 pub crosshair_label_text: Rgba,
47 pub font_size: Css,
49 pub axis_padding: Css,
51 pub line: Rgba,
53}
54
55const UP: Rgba = Rgba::hex(0x0026_A69A);
56const DOWN: Rgba = Rgba::hex(0x00EF_5350);
57
58impl Theme {
59 pub const fn light() -> Self {
61 Self {
62 background: Rgba::hex(0x00FF_FFFF),
63 text: Rgba::hex(0x001F_232B),
64 grid: Rgba::hex(0x00EE_F0F4),
65 axis_line: Rgba::hex(0x00D5_D9E0),
66 up: UP,
67 down: DOWN,
68 up_wick: UP,
69 down_wick: DOWN,
70 volume_up: UP.with_alpha(110),
71 volume_down: DOWN.with_alpha(110),
72 crosshair: Rgba::hex(0x0095_98A1),
73 crosshair_label_bg: Rgba::hex(0x0013_1722),
74 crosshair_label_text: Rgba::hex(0x00FF_FFFF),
75 font_size: Css(11.0),
76 axis_padding: Css(6.0),
77 line: Rgba::hex(0x0029_62FF),
78 }
79 }
80
81 pub const fn dark() -> Self {
83 Self {
84 background: Rgba::hex(0x0013_161C),
85 text: Rgba::hex(0x00C9_CDD6),
86 grid: Rgba::hex(0x0021_292F),
87 axis_line: Rgba::hex(0x003A_404A),
88 crosshair: Rgba::hex(0x0075_8696),
89 crosshair_label_bg: Rgba::hex(0x0036_3A45),
90 ..Self::light()
91 }
92 }
93}
94
95impl Default for Theme {
96 fn default() -> Self {
97 Self::light()
98 }
99}