[][src]Struct colorskill::RGB

pub struct RGB { /* fields omitted */ }

Methods

impl RGB[src]

pub fn new(red: u8, green: u8, blue: u8) -> RGB[src]

Makes a new RGB from three u8 values.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);

pub fn from_tuple(t: (u8, u8, u8)) -> RGB[src]

Makes a new RGB from a u8 tuple.

Example

use colorskill::RGB;
let c = RGB::from_tuple((22, 95, 83));

pub fn get_red(&self) -> u8[src]

Gets the red RGB value.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let red = c.get_red();

pub fn get_green(&self) -> u8[src]

Gets the green RGB value.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let green = c.get_green();

pub fn get_blue(&self) -> u8[src]

Gets the blue RGB value.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let blue = c.get_blue();

pub fn set_red(&mut self, value: u8)[src]

Sets the red RGB value.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.set_red(80);

pub fn set_green(&mut self, value: u8)[src]

Sets the green RGB value.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.set_green(80);

pub fn set_blue(&mut self, value: u8)[src]

Sets the blue RGB value.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.set_blue(80);

pub fn set_from_tuple(&mut self, t: (u8, u8, u8))[src]

Sets all the RGB values from a tuple.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.set_from_tuple((19, 23, 129));

pub fn get_tuple(&self) -> (u8, u8, u8)[src]

Gets the RGB values in a tuple.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let t = c.get_tuple();

pub fn make_darker(&mut self, amount: f64)[src]

Makes the RGB darker by an amount.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.make_darker(20.0);

pub fn make_lighter(&mut self, amount: f64)[src]

Makes the RGB lighter by an amount.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.make_lighter(20.0);

pub fn randomize(&mut self)[src]

Randomizes the RGB values.

Example

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.randomize();

pub fn get_hue(&self) -> f64[src]

Returns the HSL hue value

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let hue = c.get_hue();

pub fn get_saturation(&self) -> f64[src]

Returns the HSL saturation value

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let saturation = c.get_saturation();

pub fn get_lightness(&self) -> f64[src]

Returns the HSL lightness value

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let lightness = c.get_lightness();

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

Turns the RGB into a string.

See the to_string definition to check what the output is.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let s = c.to_string();

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

Turns the RGB into a string.

See the to_string_2 definition to check what the output is.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let s = c.to_string_2();

pub fn to_string_3(&self, prepend: &str) -> String[src]

Turns the RGB into a string.

See the to_string_3 definition to check what the output is.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let s = c.to_string_3("RGB");

pub fn to_string_4(&self, prepend: &str) -> String[src]

Turns the RGB into a string.

See the to_string_4 definition to check what the output is.

Example

use colorskill::RGB;
let c = RGB::new(34, 66, 94);
let s = c.to_string_4("RGB");

pub fn change(&mut self, s: &str)[src]

Uses the parse function to change the values of the RGB.

Check the parse_color definition to check how to use it.

Examples

use colorskill::RGB;
let mut c = RGB::new(34, 66, 94);
c.change("red");
c.change("46,39,199");
c.change("darker");
c.change("lighter");
c.change("random");

Auto Trait Implementations

impl Send for RGB

impl Unpin for RGB

impl Sync for RGB

impl UnwindSafe for RGB

impl RefUnwindSafe for RGB

Blanket Implementations

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.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,