2 releases (1 stable)
Uses old Rust 2015
1.0.1 | Nov 21, 2018 |
---|---|
0.1.0 | May 6, 2018 |
#527 in Unix APIs
Used in i3-style
135KB
2.5K
SLoC
colornamer-rs
Give me a color and I will name it.
colornamer-rs is in the early stages of development and the api should be considered unstable
About
Naming things is one of the hard things in computer science.
Colornamer-rs is a library written in Rust that helps you come up with a good name for a color.
It does this by converting the color to Lab color space and using the Delta E formula to compare the color difference in a list of colors with known names and finding the nearest neighbor.
Example
extern crate colornamer;
use colornamer::{ColorNamer, Colors};
fn main() {
let colornamer = ColorNamer::new(Colors::HTML);
let name: String = colornamer.name_hex_color("#1E90FF").unwrap()
println!("I will call this color '{}'", name);
}
Lists
The color names are derived from several lists:
- roygbiv
- basic
- HTML
- X11
- Pantone
- ntc - an astounding collection of over 1500 named colors.
Acknowledgements
This library is based on the wonderful color-namer library for nodejs.
Color difference formulas were found at easyrgb.com.
Further reading:
License
MIT (see LICENSE)
Dependencies
~110KB