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