A Rust library for converting between color spaces and comparing colors, ported from https://github.com/berendeanicolae/ColorSpace.
Color Conversion
You can convert between any supported color spaces using the from
trait method:
let rgb = new;
let hsv = from;
assert_eq!;
You can also do this generically with the from_color
method:
let rgb = new;
let hsv = from_color;
assert_eq!;
Comparing Colors
You can compare colors by using the compare_*
methods:
let rgb = new;
let hsv = new;
let diff = rgb.compare_cie2000;
assert_eq!;
// these two colors are the same, so the difference is zero
Currently Supported Color Spaces
- CMY
- CMYK
- HSL
- HSB
- HSV
- CIE L*AB
- Hunter LAB
- LCH
- LUV
- RGB
- XYZ
- YXY
Currently Supported Comparisons
- Euclidean
- CIE1976
- CIE2000
- CMC