[][src]Crate deltae

Calculate Delta E (color difference) between two colors in CIE Lab space.

Examples

extern crate deltae;
use deltae::{DeltaE, DEMethod::DE2000};
use deltae::color::LabValue;
use std::str::FromStr;

fn main() {
    let lab0 = LabValue::from_str("89.73, 1.88, -6.96").unwrap();
    let lab1 = LabValue {
        l: 95.08,
        a: -0.17,
        b: -10.81,
    };

    println!("{}", lab0); // [L:89.73, a:1.88, b:-6.96]

    let de0 = DeltaE::new(&lab0, &lab1, DE2000).round_to(4);

    println!("{}: {}", de0.method, de0.value); // DE2000: 5.3169

    let de1 = DeltaE::from(
        "89.73, 1.88, -6.96",
        "95.08, -0.17, -10.81",
        "DE2000"
    ).unwrap();

    assert_eq!(de0, de1.round_to(4));

    let lch0 = lab0.to_lch();
    let lab2 = lch0.to_lab();

    println!("{}", lch0); // [L:89.73, c:7.2094, h:285.1157]

    assert_eq!(lab0.round_to(4), lab2.round_to(4));
}

Modules

color

Manipulate and convert CIE L*a*b* and Lch colors.

Structs

DeltaE

Enums

DEMethod

Traits

FromStr

Parse a value from a string