plotters/style/
palette.rs

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