embedded_menu/theme/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use embedded_graphics::{pixelcolor::BinaryColor, prelude::PixelColor};

pub trait Theme: Copy {
    type Color: PixelColor + Default;

    fn text_color(&self) -> Self::Color;
    fn selected_text_color(&self) -> Self::Color;
    fn selection_color(&self) -> Self::Color;
}

impl Theme for BinaryColor {
    type Color = BinaryColor;

    fn text_color(&self) -> Self::Color {
        *self
    }

    fn selected_text_color(&self) -> Self::Color {
        self.invert()
    }

    fn selection_color(&self) -> Self::Color {
        *self
    }
}