1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms)]
#![allow(clippy::excessive_precision)]
mod linear_rgb;
mod oklab;
mod srgb;
mod xyz;
pub use linear_rgb::LinearRgb;
pub use oklab::Oklab;
pub use srgb::Srgb;
pub use xyz::Xyz;
pub trait Color {
fn from_xyz(xyz: Xyz) -> Self;
fn to_xyz(self) -> Xyz;
}
pub fn convert<In: Color, Out: Color>(color: In) -> Out {
let xyz = color.to_xyz();
Out::from_xyz(xyz)
}