mirror of
https://github.com/Feliix42/ssd1675.git
synced 2024-11-21 18:36:30 +00:00
Impl From<RawU8> for Color
This commit is contained in:
parent
050e94933d
commit
6871d3763a
1 changed files with 11 additions and 0 deletions
11
src/color.rs
11
src/color.rs
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue