Module palette::chromatic_adaptation

source ·
Expand description

Convert colors from one reference white point to another

Chromatic adaptation is the human visual system’s ability to adjust to changes in illumination in order to preserve the appearance of object colors. It is responsible for the stable appearance of object colours despite the wide variation of light which might be reflected from an object and observed by our eyes.

This library provides three methods for chromatic adaptation Bradford (which is the default), VonKries and XyzScaling

use palette::Xyz;
use palette::white_point::{A, C};
use palette::chromatic_adaptation::AdaptInto;


let a = Xyz::<A, f32>::new(0.315756, 0.162732, 0.015905);

//Will convert Xyz<A, f32> to Xyz<C, f32> using Bradford chromatic adaptation
let c: Xyz<C, f32> = a.adapt_into();

//Should print {x: 0.257963, y: 0.139776,z: 0.058825}
println!("{:?}", c)

Structs§

Enums§

  • Chromatic adaptation methods implemented in the library

Traits§

  • Trait to convert color from one reference white point to another
  • Trait to convert color with one reference white point into another
  • Generates a conversion matrix to convert the Xyz tristimulus values from one illuminant to another (source_wp to destination_wp)