libk now replaces the plethora of lib crates #5
@@ -14,6 +14,7 @@ pub enum Colour {
|
||||
White = 0xFFFFFFFF,
|
||||
}
|
||||
|
||||
#[allow(clippy::use_self)]
|
||||
impl From<Colour> for u32 {
|
||||
fn from(val: Colour) -> Self {
|
||||
match val {
|
||||
@@ -37,17 +38,17 @@ impl From<Colour> for u32 {
|
||||
impl core::fmt::Display for Colour {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
Colour::ARGB(r, g, b, a) => write!(f, "RGBA(#{:x}{:x}{:x}{:x})", r, g, b, a),
|
||||
Colour::RGB(r, g, b) => write!(f, "RGB(#{:x}{:x}{:x})", r, g, b),
|
||||
Colour::HexARGB(hex) => write!(f, "Hex(#{:x})", hex),
|
||||
Colour::Black => write!(f, "Black"),
|
||||
Colour::Blue => write!(f, "Blue"),
|
||||
Colour::Green => write!(f, "Green"),
|
||||
Colour::Cyan => write!(f, "Cyan"),
|
||||
Colour::Red => write!(f, "Red"),
|
||||
Colour::Magenta => write!(f, "Magenta"),
|
||||
Colour::Yellow => write!(f, "Yellow"),
|
||||
Colour::White => write!(f, "White"),
|
||||
Self::ARGB(r, g, b, a) => write!(f, "RGBA(#{:x}{:x}{:x}{:x})", r, g, b, a),
|
||||
Self::RGB(r, g, b) => write!(f, "RGB(#{:x}{:x}{:x})", r, g, b),
|
||||
Self::HexARGB(hex) => write!(f, "Hex(#{:x})", hex),
|
||||
Self::Black => write!(f, "Black"),
|
||||
Self::Blue => write!(f, "Blue"),
|
||||
Self::Green => write!(f, "Green"),
|
||||
Self::Cyan => write!(f, "Cyan"),
|
||||
Self::Red => write!(f, "Red"),
|
||||
Self::Magenta => write!(f, "Magenta"),
|
||||
Self::Yellow => write!(f, "Yellow"),
|
||||
Self::White => write!(f, "White"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user