Skip to main content

sandbox_quant/charting/
style.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub struct RgbColor {
3    pub r: u8,
4    pub g: u8,
5    pub b: u8,
6}
7
8impl RgbColor {
9    pub const fn new(r: u8, g: u8, b: u8) -> Self {
10        Self { r, g, b }
11    }
12}
13
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub struct ChartTheme {
16    pub background: RgbColor,
17    pub grid: RgbColor,
18    pub axis: RgbColor,
19    pub text: RgbColor,
20    pub bull_candle: RgbColor,
21    pub bear_candle: RgbColor,
22}
23
24impl Default for ChartTheme {
25    fn default() -> Self {
26        Self {
27            background: RgbColor::new(16, 20, 24),
28            grid: RgbColor::new(46, 54, 62),
29            axis: RgbColor::new(170, 176, 184),
30            text: RgbColor::new(220, 225, 230),
31            bull_candle: RgbColor::new(84, 208, 136),
32            bear_candle: RgbColor::new(255, 110, 110),
33        }
34    }
35}