Rgb

Struct Rgb 

Source
pub struct Rgb { /* private fields */ }
Expand description

The RGB color model.

Has red, green, blue and optional alpha channel fields. Red, green, blue values are stored between 0.0 and 255.0, alpha is between 0.0 and 1.0. If inputted or received values are exceeds the allowed value, or is less than zero it will be equalize to limit.

§Example

use colorsys::{Rgb, Hsl, prelude::*};
let mut rgb1 = Rgb::from((100.0, 255.0, 17.0));
// Rgb { r: 100.0, g: 255.0, b: 17.0, a: None }

let green = rgb1.green();
// 255.0

rgb1.set_red(108.3);
// Rgb { r: 108.3, g: 255.0, b: 17.0, .. }

let mut hsl: Hsl = rgb1.into();
// ~Hsl { h: 96.98, s: 100.0, l: 53.333, .. }

hsl.saturate( SaturationInSpace::Hsl(-57.901) );
// ~Hsl { h: 96.98, s: 42.099, l: 53.333, .. }

let mut rgb2 = Rgb::from(&hsl);
// ~Rgb { r: 124.34, g: 186.1, b: 85.9, .. }

let rgb2tuple: (f64,f64,f64) = rgb2.as_ref().into();
// (124.34, 186.1,85.9)

rgb2 += Rgb::from_hex_str("#35f15b").unwrap();;
// ~Rgb { r: 177.33, g: 255.0, b: 176.902, .. }

rgb2.set_green(-150.0);
assert_eq!(rgb2.green(), 0.0);

rgb2.lighten(-13.123);
// ~Rgb { r: 110.41, g: 0.0, b: 110.1, .. }

rgb2.grayscale_simple();
// ~Rgb { r: 55.2, g: 55.2, b: 55.2, .. }

let css_string = rgb2.to_css_string();
assert_eq!(css_string, "rgb(55,55,55)");

Implementations§

Source§

impl Rgb

Source

pub fn new(r: f64, g: f64, b: f64, a: Option<f64>) -> Rgb

Source

pub fn from_hex_str(s: &str) -> Result<Rgb, ParseError>

Source

pub fn to_hex_string(&self) -> String

Source

pub fn red(&self) -> f64

Source

pub fn green(&self) -> f64

Source

pub fn blue(&self) -> f64

Source

pub fn get_red(&self) -> f64

👎Deprecated since 0.7.0: Please use red instead
Source

pub fn get_green(&self) -> f64

👎Deprecated since 0.7.0: Please use green instead
Source

pub fn get_blue(&self) -> f64

👎Deprecated since 0.7.0: Please use blue instead
Source

pub fn set_red(&mut self, val: f64)

Source

pub fn set_green(&mut self, val: f64)

Source

pub fn set_blue(&mut self, val: f64)

Source

pub fn to_css_string(&self) -> String

Returns a String that can be used in CSS.

§Example
use colorsys::{Rgb};

let rgb = Rgb::from([55.0,31.1, 201.9]);
assert_eq!(rgb.to_css_string(), "rgb(55,31,202)");
Source

pub fn grayscale(&mut self, method: GrayScaleMethod)

Source

pub fn iter(&self) -> ColorUnitsIter

Returns an iterator over three color units and the possibly alpha value.

Source

pub fn as_ratio(&self) -> RgbRatio

Returns an RGB representation with values converted to floar from 0.0 to 1.0

Trait Implementations§

Source§

impl<'a> Add for &'a Rgb

Source§

type Output = Rgb

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Rgb) -> Rgb

Performs the + operation. Read more
Source§

impl<'a> Add for &'a mut Rgb

Source§

type Output = Rgb

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a mut Rgb) -> Rgb

Performs the + operation. Read more
Source§

impl Add for Rgb

Source§

type Output = Rgb

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Rgb) -> Rgb

Performs the + operation. Read more
Source§

impl AddAssign for Rgb

Source§

fn add_assign(&mut self, rhs: Rgb)

Performs the += operation. Read more
Source§

impl ApproxEq<Hsl> for Rgb

Source§

fn approx_eq(&self, hsl: &Hsl) -> bool

Source§

fn approx_eq_clarify(&self, hsl: &Hsl, precision: f64) -> bool

Source§

impl ApproxEq<Rgb> for Hsl

Source§

fn approx_eq(&self, rgb: &Rgb) -> bool

Source§

fn approx_eq_clarify(&self, rgb: &Rgb, precision: f64) -> bool

Source§

impl AsRef<Rgb> for Rgb

Source§

fn as_ref(&self) -> &Rgb

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Rgb

Source§

fn clone(&self) -> Rgb

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ColorTransform for Rgb

Source§

fn lighten(&mut self, amt: f64)

Lighten or darken color. amt is a percent with negative values - -100..100

§Example
use colorsys::{Rgb,ColorTransform, ColorTuple};
let tuple = (30.0, 108.0, 77.0);
let mut rgb = Rgb::from(&tuple);

rgb.lighten(20.0);
assert_eq!(rgb.to_css_string(), "rgb(52,188,134)" );

rgb.lighten(-20.0);
assert_eq!(rgb.to_css_string(), "rgb(30,108,77)" );

rgb.lighten(-20.0);
assert_eq!(rgb.to_css_string(), "rgb(8,28,20)" );

rgb.lighten(301.123);
assert_eq!(rgb.to_css_string(), "rgb(255,255,255)" );
Source§

fn saturate(&mut self, sat: SaturationInSpace)

Saturate/desaturate color. Value is percent: -100..100. You need specify in what color space you want to increase/decrease saturation.
Source§

fn adjust_hue(&mut self, hue: f64)

increase/decrease color tone. Value is degree - -360..360.
Source§

fn grayscale_simple(&mut self)

Brings color to a shade of gray. For more specific grayscale methods see Rgb.grayscale
Source§

fn invert(&mut self)

Just inverts color
Source§

impl Debug for Rgb

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Rgb

Source§

fn default() -> Rgb

Returns the “default value” for a type. Read more
Source§

impl From<&[f32; 3]> for Rgb

Source§

fn from(v: &[f32; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[f32; 4]> for Rgb

Source§

fn from(v: &[f32; 4]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[f64; 3]> for Rgb

Source§

fn from(v: &[f64; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[f64; 4]> for Rgb

Source§

fn from(v: &[f64; 4]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[i16; 3]> for Rgb

Source§

fn from(v: &[i16; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[i32; 3]> for Rgb

Source§

fn from(v: &[i32; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[i64; 3]> for Rgb

Source§

fn from(v: &[i64; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[u16; 3]> for Rgb

Source§

fn from(v: &[u16; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[u32; 3]> for Rgb

Source§

fn from(v: &[u32; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[u64; 3]> for Rgb

Source§

fn from(v: &[u64; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&[u8; 3]> for Rgb

Source§

fn from(v: &[u8; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(f32, f32, f32)> for Rgb

Source§

fn from(v: &(f32, f32, f32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(f32, f32, f32, f32)> for Rgb

Source§

fn from(v: &(f32, f32, f32, f32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(f64, f64, f64)> for Rgb

Source§

fn from(v: &(f64, f64, f64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(f64, f64, f64, f64)> for Rgb

Source§

fn from(v: &(f64, f64, f64, f64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(i16, i16, i16)> for Rgb

Source§

fn from(v: &(i16, i16, i16)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(i32, i32, i32)> for Rgb

Source§

fn from(v: &(i32, i32, i32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(i64, i64, i64)> for Rgb

Source§

fn from(v: &(i64, i64, i64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(u16, u16, u16)> for Rgb

Source§

fn from(v: &(u16, u16, u16)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(u32, u32, u32)> for Rgb

Source§

fn from(v: &(u32, u32, u32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(u64, u64, u64)> for Rgb

Source§

fn from(v: &(u64, u64, u64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&(u8, u8, u8)> for Rgb

Source§

fn from(v: &(u8, u8, u8)) -> Rgb

Converts to this type from the input type.
Source§

impl From<&Cmyk> for Rgb

Source§

fn from(cmyk: &Cmyk) -> Rgb

Converts to this type from the input type.
Source§

impl From<&Hsl> for Rgb

Source§

fn from(hsl: &Hsl) -> Rgb

§Example
use colorsys::{Rgb,Hsl,prelude::*};
let hsl = Hsl::from(&(48.0, 70.0, 50.0));
let rgb: Rgb = Rgb::from(&hsl);
assert_eq!(rgb.to_css_string(), "rgb(217,181,38)");
Source§

impl From<&Rgb> for Hsl

Source§

fn from(rgb: &Rgb) -> Hsl

§Example
use colorsys::{Rgb,Hsl,prelude::*};
let rgb = Rgb::from(&(215.0, 231.0, 236.0));
let hsl = Hsl::from(&rgb);
assert_eq!(hsl.to_css_string(), "hsl(194,36%,88%)");
Source§

impl From<&RgbRatio> for Rgb

Source§

fn from(r: &RgbRatio) -> Rgb

Converts to this type from the input type.
Source§

impl From<&mut Cmyk> for Rgb

Source§

fn from(cmyk: &mut Cmyk) -> Rgb

Converts to this type from the input type.
Source§

impl From<&mut Hsl> for Rgb

Source§

fn from(hsl: &mut Hsl) -> Rgb

§Example
use colorsys::{Rgb,Hsl,prelude::*};
let mut hsl = Hsl::from(&(359.0, 33.0, 77.0));
let rgb_string = Rgb::from(&mut hsl).to_css_string();
assert_eq!(rgb_string, "rgb(216,177,178)");
Source§

impl From<&mut Rgb> for Hsl

Source§

fn from(rgb: &mut Rgb) -> Hsl

§Example
use colorsys::{Rgb,Hsl,prelude::*};
let mut rgb = Rgb::from(&(0.0, 0.0, 0.0));
let hsl_string = Hsl::from(&mut rgb).to_css_string();
assert_eq!(hsl_string, "hsl(0,0%,0%)");
Source§

impl From<&mut RgbRatio> for Rgb

Source§

fn from(r: &mut RgbRatio) -> Rgb

Converts to this type from the input type.
Source§

impl From<[f32; 3]> for Rgb

Source§

fn from(v: [f32; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[f32; 4]> for Rgb

Source§

fn from(v: [f32; 4]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[f64; 3]> for Rgb

Source§

fn from(v: [f64; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[f64; 4]> for Rgb

Source§

fn from(v: [f64; 4]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[i16; 3]> for Rgb

Source§

fn from(v: [i16; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[i32; 3]> for Rgb

Source§

fn from(v: [i32; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[i64; 3]> for Rgb

Source§

fn from(v: [i64; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[u16; 3]> for Rgb

Source§

fn from(v: [u16; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[u32; 3]> for Rgb

Source§

fn from(v: [u32; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[u64; 3]> for Rgb

Source§

fn from(v: [u64; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<[u8; 3]> for Rgb

Source§

fn from(v: [u8; 3]) -> Rgb

Converts to this type from the input type.
Source§

impl From<(f32, f32, f32)> for Rgb

Source§

fn from(v: (f32, f32, f32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(f32, f32, f32, f32)> for Rgb

Source§

fn from(v: (f32, f32, f32, f32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(f64, f64, f64)> for Rgb

Source§

fn from(v: (f64, f64, f64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(f64, f64, f64, f64)> for Rgb

Source§

fn from(v: (f64, f64, f64, f64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(i16, i16, i16)> for Rgb

Source§

fn from(v: (i16, i16, i16)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(i32, i32, i32)> for Rgb

Source§

fn from(v: (i32, i32, i32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(i64, i64, i64)> for Rgb

Source§

fn from(v: (i64, i64, i64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(u16, u16, u16)> for Rgb

Source§

fn from(v: (u16, u16, u16)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(u32, u32, u32)> for Rgb

Source§

fn from(v: (u32, u32, u32)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(u64, u64, u64)> for Rgb

Source§

fn from(v: (u64, u64, u64)) -> Rgb

Converts to this type from the input type.
Source§

impl From<(u8, u8, u8)> for Rgb

Source§

fn from(v: (u8, u8, u8)) -> Rgb

Converts to this type from the input type.
Source§

impl From<Ansi256> for Rgb

Source§

fn from(ansi256: Ansi256) -> Rgb

Converts to this type from the input type.
Source§

impl From<Cmyk> for Rgb

Source§

fn from(cmyk: Cmyk) -> Rgb

Converts to this type from the input type.
Source§

impl From<Hsl> for Rgb

Source§

fn from(hsl: Hsl) -> Rgb

§Example
use colorsys::{Rgb,Hsl,prelude::*};
let hsl = Hsl::from(&(192.0, 67.0, 28.0));
let rgb_string = Rgb::from(hsl).to_css_string();
assert_eq!(rgb_string, "rgb(24,100,119)");
Source§

impl From<Rgb> for Hsl

Source§

fn from(rgb: Rgb) -> Hsl

§Example
use colorsys::{Rgb,Hsl,prelude::*};
let rgb = Rgb::from(&(255.0, 255.0, 255.0));
let hsl_string = Hsl::from(rgb).to_css_string();
assert_eq!(hsl_string, "hsl(0,0%,100%)");
Source§

impl From<RgbRatio> for Rgb

Source§

fn from(r: RgbRatio) -> Rgb

Converts to this type from the input type.
Source§

impl FromStr for Rgb

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Rgb, ParseError>

Parses a string s to return a value of this type. Read more
Source§

impl<'a> Into<[f32; 3]> for &'a Rgb

Source§

fn into(self) -> [f32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f32; 3]> for &'a mut Rgb

Source§

fn into(self) -> [f32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[f32; 3]> for Rgb

Source§

fn into(self) -> [f32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f32; 4]> for &'a Rgb

Source§

fn into(self) -> [f32; 4]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f32; 4]> for &'a mut Rgb

Source§

fn into(self) -> [f32; 4]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[f32; 4]> for Rgb

Source§

fn into(self) -> [f32; 4]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f64; 3]> for &'a Rgb

Source§

fn into(self) -> [f64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f64; 3]> for &'a mut Rgb

Source§

fn into(self) -> [f64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[f64; 3]> for Rgb

Source§

fn into(self) -> [f64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f64; 4]> for &'a Rgb

Source§

fn into(self) -> [f64; 4]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[f64; 4]> for &'a mut Rgb

Source§

fn into(self) -> [f64; 4]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[f64; 4]> for Rgb

Source§

fn into(self) -> [f64; 4]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[i16; 3]> for &'a Rgb

Source§

fn into(self) -> [i16; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[i16; 3]> for &'a mut Rgb

Source§

fn into(self) -> [i16; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[i16; 3]> for Rgb

Source§

fn into(self) -> [i16; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[i32; 3]> for &'a Rgb

Source§

fn into(self) -> [i32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[i32; 3]> for &'a mut Rgb

Source§

fn into(self) -> [i32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[i32; 3]> for Rgb

Source§

fn into(self) -> [i32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[i64; 3]> for &'a Rgb

Source§

fn into(self) -> [i64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[i64; 3]> for &'a mut Rgb

Source§

fn into(self) -> [i64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[i64; 3]> for Rgb

Source§

fn into(self) -> [i64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u16; 3]> for &'a Rgb

Source§

fn into(self) -> [u16; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u16; 3]> for &'a mut Rgb

Source§

fn into(self) -> [u16; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[u16; 3]> for Rgb

Source§

fn into(self) -> [u16; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u32; 3]> for &'a Rgb

Source§

fn into(self) -> [u32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u32; 3]> for &'a mut Rgb

Source§

fn into(self) -> [u32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[u32; 3]> for Rgb

Source§

fn into(self) -> [u32; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u64; 3]> for &'a Rgb

Source§

fn into(self) -> [u64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u64; 3]> for &'a mut Rgb

Source§

fn into(self) -> [u64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[u64; 3]> for Rgb

Source§

fn into(self) -> [u64; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u8; 3]> for &'a Rgb

Source§

fn into(self) -> [u8; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<[u8; 3]> for &'a mut Rgb

Source§

fn into(self) -> [u8; 3]

Converts this type into the (usually inferred) input type.
Source§

impl Into<[u8; 3]> for Rgb

Source§

fn into(self) -> [u8; 3]

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f32, f32, f32)> for &'a Rgb

Source§

fn into(self) -> (f32, f32, f32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f32, f32, f32)> for &'a mut Rgb

Source§

fn into(self) -> (f32, f32, f32)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(f32, f32, f32)> for Rgb

Source§

fn into(self) -> (f32, f32, f32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f32, f32, f32, f32)> for &'a Rgb

Source§

fn into(self) -> (f32, f32, f32, f32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f32, f32, f32, f32)> for &'a mut Rgb

Source§

fn into(self) -> (f32, f32, f32, f32)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(f32, f32, f32, f32)> for Rgb

Source§

fn into(self) -> (f32, f32, f32, f32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f64, f64, f64)> for &'a Rgb

Source§

fn into(self) -> (f64, f64, f64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f64, f64, f64)> for &'a mut Rgb

Source§

fn into(self) -> (f64, f64, f64)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(f64, f64, f64)> for Rgb

Source§

fn into(self) -> (f64, f64, f64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f64, f64, f64, f64)> for &'a Rgb

Source§

fn into(self) -> (f64, f64, f64, f64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(f64, f64, f64, f64)> for &'a mut Rgb

Source§

fn into(self) -> (f64, f64, f64, f64)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(f64, f64, f64, f64)> for Rgb

Source§

fn into(self) -> (f64, f64, f64, f64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(i16, i16, i16)> for &'a Rgb

Source§

fn into(self) -> (i16, i16, i16)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(i16, i16, i16)> for &'a mut Rgb

Source§

fn into(self) -> (i16, i16, i16)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(i16, i16, i16)> for Rgb

Source§

fn into(self) -> (i16, i16, i16)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(i32, i32, i32)> for &'a Rgb

Source§

fn into(self) -> (i32, i32, i32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(i32, i32, i32)> for &'a mut Rgb

Source§

fn into(self) -> (i32, i32, i32)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(i32, i32, i32)> for Rgb

Source§

fn into(self) -> (i32, i32, i32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(i64, i64, i64)> for &'a Rgb

Source§

fn into(self) -> (i64, i64, i64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(i64, i64, i64)> for &'a mut Rgb

Source§

fn into(self) -> (i64, i64, i64)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(i64, i64, i64)> for Rgb

Source§

fn into(self) -> (i64, i64, i64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u16, u16, u16)> for &'a Rgb

Source§

fn into(self) -> (u16, u16, u16)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u16, u16, u16)> for &'a mut Rgb

Source§

fn into(self) -> (u16, u16, u16)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(u16, u16, u16)> for Rgb

Source§

fn into(self) -> (u16, u16, u16)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u32, u32, u32)> for &'a Rgb

Source§

fn into(self) -> (u32, u32, u32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u32, u32, u32)> for &'a mut Rgb

Source§

fn into(self) -> (u32, u32, u32)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(u32, u32, u32)> for Rgb

Source§

fn into(self) -> (u32, u32, u32)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u64, u64, u64)> for &'a Rgb

Source§

fn into(self) -> (u64, u64, u64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u64, u64, u64)> for &'a mut Rgb

Source§

fn into(self) -> (u64, u64, u64)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(u64, u64, u64)> for Rgb

Source§

fn into(self) -> (u64, u64, u64)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u8, u8, u8)> for &'a Rgb

Source§

fn into(self) -> (u8, u8, u8)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<(u8, u8, u8)> for &'a mut Rgb

Source§

fn into(self) -> (u8, u8, u8)

Converts this type into the (usually inferred) input type.
Source§

impl Into<(u8, u8, u8)> for Rgb

Source§

fn into(self) -> (u8, u8, u8)

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<RgbRatio> for &'a Rgb

Source§

fn into(self) -> RgbRatio

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<RgbRatio> for &'a mut Rgb

Source§

fn into(self) -> RgbRatio

Converts this type into the (usually inferred) input type.
Source§

impl Into<RgbRatio> for Rgb

Source§

fn into(self) -> RgbRatio

Converts this type into the (usually inferred) input type.
Source§

impl<'a> IntoIterator for &'a Rgb

Source§

type Item = f64

The type of the elements being iterated over.
Source§

type IntoIter = ColorUnitsIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> ColorUnitsIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Rgb

Source§

type Item = f64

The type of the elements being iterated over.
Source§

type IntoIter = ColorUnitsIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> ColorUnitsIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for Rgb

Source§

fn eq(&self, other: &Rgb) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Sub for &'a Rgb

Source§

type Output = Rgb

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Rgb) -> Rgb

Performs the - operation. Read more
Source§

impl<'a> Sub for &'a mut Rgb

Source§

type Output = Rgb

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a mut Rgb) -> Rgb

Performs the - operation. Read more
Source§

impl Sub for Rgb

Source§

type Output = Rgb

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Rgb) -> Rgb

Performs the - operation. Read more
Source§

impl SubAssign for Rgb

Source§

fn sub_assign(&mut self, rhs: Rgb)

Performs the -= operation. Read more
Source§

impl StructuralPartialEq for Rgb

Auto Trait Implementations§

§

impl Freeze for Rgb

§

impl RefUnwindSafe for Rgb

§

impl Send for Rgb

§

impl Sync for Rgb

§

impl Unpin for Rgb

§

impl UnwindSafe for Rgb

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ApproxEq<T> for T
where T: GetColorUnits,

Source§

fn approx_eq(&self, other: &T) -> bool

Source§

fn approx_eq_clarify(&self, other: &T, precision: f64) -> bool

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ColorAlpha for T
where T: GetColorUnits,

Source§

fn alpha(&self) -> f64

Returns alpha channel. If it not set will returns 1.0
Source§

fn get_alpha(&self) -> f64

👎Deprecated since 0.7.0: Please use alpha instead
Returns alpha channel. If it not set will returns 1.0
Source§

fn set_alpha(&mut self, val: f64)

Sets alpha channel Read more
Source§

fn opacify(&mut self, val: f64)

Increase/decrease color alpha channel with specified value. Value can be negative. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.