1use embedded_graphics::pixelcolor::RgbColor;
2
3use super::{UnpackStyle, blend::Blend};
4use packed_font_structs::AaColor;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub struct TwoColor<C> {
8 pub foreground: C,
9 pub background: C,
10}
11
12impl<C> UnpackStyle for TwoColor<C>
13where
14 C: RgbColor + Blend<C, Target = C>,
15{
16 type Color = C;
17 fn map_color(&self, grade: AaColor) -> Self::Color {
18 self.foreground.blend(&self.background, grade)
19 }
20 fn background_color(&self) -> Option<Self::Color> {
21 Some(self.background)
22 }
23}