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
Color value

Functions§

compare_by_hsv
Compare Colors by hue, then saturation, then value
compare_by_rgb
Compare Colors by red, then green, then blue
load_rgb_buffer
Load a buffer into the existing Named Color database.
load_rgb_file
Load a file into the existing Named Color database.
names
Return names of available named colors
read_buffer
Load a buffer and return a Vec<String, Color)> of names and colors
read_file
Read a file and return a Vec<String, Color)> of names and colors
xkcd
Load colors from the XKCD Color Database

Type Aliases§

Colour