Skip to main content

densa_grid/
palette.rs

1use densa_core::Color;
2
3/// Grid colors: [`Palette::new`] is the dark default; change its fields for others.
4#[derive(Debug, Clone, Copy, PartialEq)]
5#[non_exhaustive]
6pub struct Palette {
7    /// Window background (what `GpuRenderer::render` clears to).
8    pub background: Color,
9    /// Header row bar.
10    pub header_background: Color,
11    /// Column titles.
12    pub header_text: Color,
13    /// Every other data row.
14    pub stripe: Color,
15    /// Cell text.
16    pub text: Color,
17    /// Placeholders and secondary text.
18    pub dim_text: Color,
19    /// Good news: a value rose, a check passed.
20    pub positive: Color,
21    /// Bad news: a value fell, a check failed.
22    pub negative: Color,
23}
24
25impl Palette {
26    /// The default dark palette.
27    pub fn new() -> Self {
28        Self {
29            background: Color::srgb(0x0D1117),
30            header_background: Color::srgb(0x161B22),
31            header_text: Color::srgb(0x8B949E),
32            stripe: Color::srgb(0x131922),
33            text: Color::srgb(0xC9D1D9),
34            dim_text: Color::srgb(0x6E7681),
35            positive: Color::srgb(0x3FB950),
36            negative: Color::srgb(0xF85149),
37        }
38    }
39}
40
41impl Default for Palette {
42    fn default() -> Self {
43        Self::new()
44    }
45}