Impl From<RawU8> for Color

This commit is contained in:
Felix Suchert 2022-08-05 21:35:04 +02:00
parent 050e94933d
commit 6871d3763a
Signed by: feliix42
GPG key ID: 24363525EA0E8A99

View file

@ -30,6 +30,17 @@ impl From<u8> for Color {
} }
} }
impl From<RawU8> for Color {
fn from(value: RawU8) -> Self {
// NOTE(feliix42): This is a very ... liberal mapping of colors and may be refined at some
// point
match value.into_inner() {
0 => Color::Black,
_ => Color::White,
}
}
}
#[cfg(feature = "graphics")] #[cfg(feature = "graphics")]
impl From<BinaryColor> for Color { impl From<BinaryColor> for Color {
fn from(value: BinaryColor) -> Self { fn from(value: BinaryColor) -> Self {