pub struct Color {
pub hex: (String, String, String),
pub rgb: (u8, u8, u8),
pub dec: (f32, f32, f32),
}Fields§
§hex: (String, String, String)§rgb: (u8, u8, u8)§dec: (f32, f32, f32)Implementations§
Source§impl Color
impl Color
Sourcepub fn new(hex_color: &str) -> Result<Self, TintedBuilderError>
pub fn new(hex_color: &str) -> Result<Self, TintedBuilderError>
Creates a Color from a hex string like "ff00ff" or "#ffcc00".
§Errors
Returns Err(TintedBuilderError::HexInputFormat) if hex_color is not a valid
6-digit hexadecimal color (optionally prefixed with #).
pub fn to_hex(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more