[][src]Struct Color::RGB

pub struct RGB(pub [u8; 3]);

Create RGB instance.

Implementations

impl RGB[src]

pub fn value(&self) -> [u8; 3][src]

Get RGB value.

pub fn inverted(&mut self) -> &mut Self[src]

Inverted rgb value.

pub fn to_hex(&self) -> String[src]

convart rgb value to hex value.

pub fn contrast_ratio(&self, rgb: [u8; 3]) -> f64[src]

Get contrast ratio between two colors.

pub fn from_hex(hex_value: &str) -> Result<Self, &str>[src]

Create RGB instance from hex value.

Examples

RGB::from_hex("#00ff00").unwrap();

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.