[−][src]Trait colors_transform::Color
Common to all trait
Associated Types
Loading content...Required methods
fn new() -> Self
Creates a black color
Example
use colors_transform::{Rgb,Color}; let black = Rgb::from(0.0,0.0,0.0); assert_eq!(black, Rgb::new());
fn from_tuple(tuple: &Self::Tuple) -> Self
Creates a color from tuple.
Example
use colors_transform::{Rgb,Hsl,Color}; let rgb = Rgb::from_tuple(&(10.0,11.0,12.0)); let hsl = Hsl::from(310.0,50.0,50.0);
fn from_tuple_with_alpha(tuple: &Self::TupleA) -> Self
fn as_tuple(&self) -> Self::Tuple
Returns tuple representation of color
Example
use colors_transform::{Hsl,Color}; let hsl_tuple = (10.0,11.0,12.0); let hsl = Hsl::from_tuple(&hsl_tuple); assert_eq!(hsl_tuple,hsl.as_tuple());
fn get_red(&self) -> f32
Returns red value of color (0.0..255.00
)
fn get_green(&self) -> f32
Returns green value of color (0.0..255.00
)
fn get_blue(&self) -> f32
Returns blue value of color (0.0..255.00
)
fn set_red(&self, val: f32) -> Self
Sets red value of color (0.0..255.00
). Returns Color
fn set_green(&self, val: f32) -> Self
Sets green value of color (0.0..255.00
). Returns Color
fn set_blue(&self, val: f32) -> Self
Sets blue value of color (0.0..255.00
). Returns Color
fn get_hue(&self) -> f32
Returns hue value of color (0.0..359.00
)
fn get_saturation(&self) -> f32
Returns saturation value of color (0.0..100.00
)
fn get_lightness(&self) -> f32
Returns lightness value of color (0.0..100.00
)
fn set_hue(&self, val: f32) -> Self
Sets hue value of color (0.0..359.00
). Returns Color
fn set_saturation(&self, val: f32) -> Self
Sets saturation value of color (0.0..100.00
). Returns Color
fn set_lightness(&self, val: f32) -> Self
Sets lightness value of color (0.0..100.00
). Returns Color
fn to_rgb(&self) -> Rgb
fn to_hsl(&self) -> Hsl
fn to_css_string(&self) -> String
Returns css string
Example
use colors_transform::{Hsl,Color}; let hsl = Hsl::from_tuple(&(301.0,27.0,91.0)); assert_eq!(hsl.to_css_string(), "hsl(301,27%,91%)");
fn adjust_hue(&self, amt: f32) -> Self
fn saturate(&self, amt: f32) -> Self
fn lighten(&self, amt: f32) -> Self
fn adjust_color(&self, col_name: RgbUnit, val: f32) -> Self
fn invert(&self) -> Self
Implementors
impl Color for Hsl
[src]
type Tuple = ColorTuple
type TupleA = ColorTupleA
fn new() -> Hsl
[src]
fn get_hue(&self) -> f32
[src]
fn get_saturation(&self) -> f32
[src]
fn get_lightness(&self) -> f32
[src]
fn set_hue(&self, val: f32) -> Hsl
[src]
fn set_saturation(&self, val: f32) -> Hsl
[src]
fn set_lightness(&self, val: f32) -> Hsl
[src]
fn get_red(&self) -> f32
[src]
fn get_green(&self) -> f32
[src]
fn get_blue(&self) -> f32
[src]
fn set_red(&self, val: f32) -> Hsl
[src]
fn set_green(&self, val: f32) -> Hsl
[src]
fn set_blue(&self, val: f32) -> Hsl
[src]
fn to_rgb(&self) -> Rgb
[src]
fn to_hsl(&self) -> Hsl
[src]
fn to_css_string(&self) -> String
[src]
fn from_tuple(t: &ColorTuple) -> Hsl
[src]
fn from_tuple_with_alpha(t: &ColorTupleA) -> Hsl
[src]
fn as_tuple(&self) -> ColorTuple
[src]
fn lighten(&self, val: f32) -> Hsl
[src]
fn saturate(&self, val: f32) -> Hsl
[src]
fn adjust_hue(&self, hue: f32) -> Hsl
[src]
fn adjust_color(&self, name: RgbUnit, val: f32) -> Hsl
[src]
fn invert(&self) -> Hsl
[src]
impl Color for Rgb
[src]
type Tuple = ColorTuple
type TupleA = ColorTupleA
fn new() -> Rgb
[src]
fn get_red(&self) -> f32
[src]
fn get_green(&self) -> f32
[src]
fn get_blue(&self) -> f32
[src]
fn set_red(&self, val: f32) -> Rgb
[src]
fn set_green(&self, val: f32) -> Rgb
[src]
fn set_blue(&self, val: f32) -> Rgb
[src]
fn get_hue(&self) -> f32
[src]
fn get_saturation(&self) -> f32
[src]
fn get_lightness(&self) -> f32
[src]
fn set_hue(&self, val: f32) -> Rgb
[src]
fn set_saturation(&self, val: f32) -> Rgb
[src]
fn set_lightness(&self, val: f32) -> Rgb
[src]
fn to_rgb(&self) -> Rgb
[src]
fn to_hsl(&self) -> Hsl
[src]
fn to_css_string(&self) -> String
[src]
Returns css string
Example
use colors_transform::{Rgb,Color}; let rgb = Rgb::from_tuple(&(225.0,101.7, 21.0)); assert_eq!(rgb.to_css_string(), "rgb(225,102,21)");