pub struct Color;Implementations§
Source§impl Color
impl Color
Sourcepub fn by_enum(&self, color: color) -> [u8; 3]
pub fn by_enum(&self, color: color) -> [u8; 3]
Get colour rgb array by enum color param.
§Example
use color_name::{
Color,
color
};
assert_eq!(Color::val().by_enum(color::white), [255, 255, 255]);
Sourcepub fn by_string(&self, color: String) -> Result<[u8; 3], u16>
pub fn by_string(&self, color: String) -> Result<[u8; 3], u16>
Get colour rgb array by String param.
§Example:
use color_name::{
Color
};
assert_eq!(Color::val().by_string("InDigo".to_string()).expect("Not found"), [75, 0, 130]);
// NOTE: the string can be at any case, it will be converted into Title-case
assert_eq!(Color::val().by_string("inDigo".to_string()).expect("Not found"), [75, 0, 130]);
assert_eq!(Color::val().by_string("IndiGo ".to_string()).expect("Not found"), [75, 0, 130]);NOTE: Return Result<[u8;3],u16> as color data [u8;3] or Not found (404).
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