plotters/style/
palette.rs

1use super::color::PaletteColor;
2
3/// Represents a color palette
4pub trait Palette {
5    /// Array of colors
6    const COLORS: &'static [(u8, u8, u8)];
7    /// Returns a color from the palette
8    fn pick(idx: usize) -> PaletteColor<Self>
9    where
10        Self: Sized,
11    {
12        PaletteColor::<Self>::pick(idx)
13    }
14}
15
16/// The palette of 99% accessibility
17pub struct Palette99;
18/// The palette of 99.99% accessibility
19pub struct Palette9999;
20/// The palette of 100% accessibility
21pub struct Palette100;
22
23impl Palette for Palette99 {
24    const COLORS: &'static [(u8, u8, u8)] = &[
25        (230, 25, 75),
26        (60, 180, 75),
27        (255, 225, 25),
28        (0, 130, 200),
29        (245, 130, 48),
30        (145, 30, 180),
31        (70, 240, 240),
32        (240, 50, 230),
33        (210, 245, 60),
34        (250, 190, 190),
35        (0, 128, 128),
36        (230, 190, 255),
37        (170, 110, 40),
38        (255, 250, 200),
39        (128, 0, 0),
40        (170, 255, 195),
41        (128, 128, 0),
42        (255, 215, 180),
43        (0, 0, 128),
44        (128, 128, 128),
45        (0, 0, 0),
46    ];
47}
48
49impl Palette for Palette9999 {
50    const COLORS: &'static [(u8, u8, u8)] = &[
51        (255, 225, 25),
52        (0, 130, 200),
53        (245, 130, 48),
54        (250, 190, 190),
55        (230, 190, 255),
56        (128, 0, 0),
57        (0, 0, 128),
58        (128, 128, 128),
59        (0, 0, 0),
60    ];
61}
62
63impl Palette for Palette100 {
64    const COLORS: &'static [(u8, u8, u8)] =
65        &[(255, 225, 25), (0, 130, 200), (128, 128, 128), (0, 0, 0)];
66}