Crate tint

source · []
Expand description

Color creation and manipulation

use tint::Color;
use tint::Colour; // Alternatively
let green = Color::from("green");
let green = Color::from("00FF00");
let green = Color::from("00ff00");
let green = Color::from("#00ff00");
let green = Color::from("#00FF00");
let green = Color::from((0,255,0));
let green = Color::from([0.,1.,0.]);
let green = Color::from(vec![0.,1.,0.]);
let green = Color::from(vec![0.,1.,0.,1.0]);
let green = Color::from(&vec![0.,1.,0.]);
let green = Color::from(&vec![0.,1.,0.,1.0]);

let green = Color::new(0.0, 1.0, 0.0, 1.0);
let green = Color::from_rgb1(0.0, 1.0, 0.0);
let green = Color::from_rgb1v(&[0.0, 1.0, 0.0]);
let green = Color::name("green");
let green = Colour::name("green");

Color names

Typical names (HTML and SVG) are available by default, and color names defined in the XKCD color database are available by running the xkcd() function

Basic Colors

https://www.w3.org/TR/css3-color/#html4

Extended Colors

https://www.w3.org/TR/css3-color/#svg-color

XKCD Colors

https://xkcd.com/color/rgb/

Structs

Color value

Functions

Compare Colors by hue, then saturation, then value

Compare Colors by red, then green, then blue

Load a buffer into the existing Named Color database.

Load a file into the existing Named Color database.

Return names of available named colors

Load a buffer and return a Vec<String, Color)> of names and colors

Read a file and return a Vec<String, Color)> of names and colors

Load colors from the XKCD Color Database

Type Definitions