[−][src]Struct Color::RGB
Create new rgb.
let rgb = RGB([0, 0, 0]);
Implementations
impl RGB
[src]
pub fn inverted(&mut self) -> &mut Self
[src]
inverted rgb color.
let inverted_rgb = rgb.inverted(); assert_eq!([255, 255, 255], rgb.0);
pub fn to_hex(&self) -> String
[src]
convart rgb to hex.
let color_hex = rgb.to_hex(); assert_eq!("ffffff", color_hex);
pub fn contrast_ratio(&self, rgb: [u8; 3]) -> f64
[src]
Get contrast ratio.
let contrast = rgb.contrast_ratio([0, 0, 0]); assert_eq!(21, contrast);
pub fn from_hex(hex_value: &str) -> Result<Self, &str>
[src]
Create RGB from hex.
let rgb2 = RGB::from_hex("#00ff00"); assert_eq!([0, 255, 00], rgb2.0);
Auto Trait Implementations
impl RefUnwindSafe for RGB
[src]
impl Send for RGB
[src]
impl Sync for RGB
[src]
impl Unpin for RGB
[src]
impl UnwindSafe for RGB
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,