A crate with color names and its values and usefull functions inluded to get similar colour name by RGB data. Based on these named-colors; Inspired heavely by https://github.com/colorjs/color-name.

Usage

Add this to your Cargo.toml:

toml [dependencies] color-name = "1.0.0"

Add this to your main.rs or any other rust file:

```rust extern crate colorname; use colorname::{ // main function to trait colours Color, // enum colour names use it with Color::value(color:color) // Ex: Color::value(color::red); color, // for lower case colour names colors, // for snake case colour names Colors, };

asserteq!(Color::name([0, 0, 0]), "Black"); // In case there's no color match that rgb param color it return "None" asserteq!(Color::name([0, 1, 1]), "None"); asserteq!(Color::name([95, 4, 1]), "None"); // to get the closest similar colour use similar() or closeto() //NOTE: closeto() is a proxy to similar() asserteq!(Color::similar([0, 1, 1]), "Black"); asserteq!(Color::similar([95, 4, 1]), "Maroon"); asserteq!(Color::close_to([95, 4, 1]), "Maroon");

asserteq!(Color::value(color::white), [255, 255, 255]); asserteq!(Color::value(color::indigo), [75, 0, 130]);

// for lower-case colors use colorname::colors; asserteq!(colors::red,[255,0,0]); asserteq!(colors::blue,[0,0,255]); asserteq!(colors::yellow,[255,255,0]); // for Snake-case colors use colorname::colors; asserteq!(Colors::Red,[255,0,0]); asserteq!(Colors::Blue,[0,0,255]); asserteq!(Colors::Yellow,[255,255,0]); ...

// Enjoy it !! ```

Notes:

Todo

Licence

MIT License