1use ratatui::style::{
4 Color,
5 Style
6};
7
8#[derive(Debug, Copy, Clone)]
10pub struct ColorSet {
11 pub c0 : Color,
12 pub c1 : Color,
13 pub c2 : Color,
14 pub c3 : Color,
15 pub hc : Color,
17}
18
19impl ColorSet {
20 pub const fn new(c0 : Color,
21 c1 : Color,
22 c2 : Color,
23 c3 : Color,
24 hc : Color) -> ColorSet {
25 ColorSet {
26 c0,
27 c1,
28 c2,
29 c3,
30 hc,
31 }
32 }
33}
34
35pub const COLORSETBW : ColorSet = ColorSet::new(Color::Black, Color::White,
37 Color::White, Color::White,
38 Color::Rgb(244,133,0));
39
40pub const COLORSETOMILU : ColorSet = ColorSet::new(Color::Rgb(5, 59, 80),
42 Color::Rgb(23, 107, 135),
43 Color::Rgb(100, 204, 197),
44 Color::Rgb(238, 238, 238),
45 Color::Rgb(225, 170, 116));
46
47pub const COLORSETNIUHI : ColorSet = ColorSet::new(Color::Rgb(0,41,170),
49 Color::Rgb(0,63,136),
50 Color::Rgb(0,80,157),
51 Color::Rgb(253,197,0),
52 Color::Rgb(255,213,0));
53
54
55pub const COLORSETDUNE : ColorSet = ColorSet::new(Color::Rgb(161,18,37),
57 Color::Rgb(223,135,53),
58 Color::Rgb(181,164,146),
59 Color::Rgb(225, 170, 116),
60 Color::Rgb(244,193,110));
61
62pub const COLORSETLD : ColorSet = ColorSet::new(Color::Rgb(255,68,0),
64 Color::Rgb(255, 170, 68),
65 Color::Rgb(255, 119, 0),
66 Color::Rgb(255, 204, 153),
67 Color::Rgb(255, 238, 204));
68
69pub const COLORSETMATRIX : ColorSet = ColorSet::new(Color::Rgb(2,2,4),
71 Color::Rgb(32,72,41),
72 Color::Rgb(34,180,85),
73 Color::Rgb(128,206,135),
74 Color::Rgb(156,229,161));
75
76pub const COLORSETSTARFIELD : ColorSet = ColorSet::new(Color::Rgb(48,76,122),
78 Color::Rgb(224,98,54),
79 Color::Rgb(215,166,75),
80 Color::Rgb(244,245,247),
81 Color::Rgb(199,33,56));
82
83pub const COLORSETGAPS : ColorSet = ColorSet::new(Color::Rgb(27,51,88),
85 Color::Rgb(228,60,65),
86 Color::Rgb(132,203,187),
87 Color::Rgb(212,202,87),
88 Color::Rgb(227,76,68));
89
90pub const COLORSETPRINCESSPEACH : ColorSet = ColorSet::new(Color::Rgb(255,8,74),
92 Color::Rgb(252,52,104),
93 Color::Rgb(255,98,137),
94 Color::Rgb(255,147,172),
95 Color::Rgb(255,194,205));
96
97
98#[derive(Debug, Copy, Clone)]
101pub struct ColorTheme {
102 pub bg0 : Color,
103 pub bg1 : Color,
104 pub fg0 : Color,
105 pub fg1 : Color,
106 pub hc : Color,
107}
108
109impl ColorTheme {
110 pub fn new() -> ColorTheme {
111 ColorTheme {
112 bg0 : Color::Black,
113 bg1 : Color::White,
114 fg0 : Color::Black,
115 fg1 : Color::White,
116 hc : Color::White,
117 }
118 }
119
120 pub fn update(&mut self, cs : &ColorSet) {
121 self.bg0 = cs.c0;
122 self.bg1 = cs.c1;
123 self.fg0 = cs.c2;
124 self.fg1 = cs.c3;
125 self.hc = cs.hc;
126 }
127
128 pub fn style(&self) -> Style {
129 Style::default().bg(self.bg0).fg(self.fg1)
130 }
131
132 pub fn style_soft(&self) -> Style {
133 Style::default().bg(self.bg1).fg(self.fg0)
134 }
135
136 pub fn highlight(&self) -> Style {
137 Style::default().bg(self.hc).fg(self.fg1)
138 }
139
140 pub fn highlight_fg(&self) -> Style {
141 Style::default().fg(self.hc)
142 }
143
144 pub fn background(&self) -> Style {
145 Style::default().bg(self.bg0)
146 }
147}
148