[][src]Trait colors_transform::Color

pub trait Color {
    type Tuple;
    fn new() -> Self;
fn from_tuple(tuple: Self::Tuple) -> Self;
fn as_tuple(&self) -> Self::Tuple;
fn get_red(&self) -> f32;
fn get_green(&self) -> f32;
fn get_blue(&self) -> f32;
fn set_red(&self, val: f32) -> Self;
fn set_green(&self, val: f32) -> Self;
fn set_blue(&self, val: f32) -> Self;
fn get_hue(&self) -> f32;
fn get_saturation(&self) -> f32;
fn get_lightness(&self) -> f32;
fn set_hue(&self, val: f32) -> Self;
fn set_saturation(&self, val: f32) -> Self;
fn set_lightness(&self, val: f32) -> Self;
fn to_rgb(&self) -> Rgb;
fn to_rgba(&self) -> Rgba;
fn to_hsl(&self) -> Hsl;
fn to_hsla(&self) -> Hsla;
fn to_css_string(&self) -> String;
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: RgbColor, val: f32) -> Self; }

Common to all trait

Associated Types

type Tuple

Loading content...

Required methods

fn new() -> Self

fn from_tuple(tuple: Self::Tuple) -> Self

fn as_tuple(&self) -> Self::Tuple

fn get_red(&self) -> f32

fn get_green(&self) -> f32

fn get_blue(&self) -> f32

fn set_red(&self, val: f32) -> Self

fn set_green(&self, val: f32) -> Self

fn set_blue(&self, val: f32) -> Self

fn get_hue(&self) -> f32

fn get_saturation(&self) -> f32

fn get_lightness(&self) -> f32

fn set_hue(&self, val: f32) -> Self

fn set_saturation(&self, val: f32) -> Self

fn set_lightness(&self, val: f32) -> Self

fn to_rgb(&self) -> Rgb

fn to_rgba(&self) -> Rgba

fn to_hsl(&self) -> Hsl

fn to_hsla(&self) -> Hsla

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: RgbColor, val: f32) -> Self

Loading content...

Implementors

impl Color for Hsl[src]

type Tuple = ColorTuple

impl Color for Hsla[src]

type Tuple = ColorTupleA

impl Color for Rgb[src]

type Tuple = ColorTuple

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)");

impl Color for Rgba[src]

type Tuple = ColorTupleA

Loading content...