#color #computer-vision #graphics #cvd #color-blindness #color-vision #vision-deficiency

no-std achroma

A tiny crate for encoding data related to color vision and color vision deficiency (CVD)

1 unstable release

0.1.0 Oct 30, 2023

#566 in Science

MIT/Apache

34KB
412 lines

achroma

License Achroma documentation CI Security audit codecov

A tiny crate for encoding data related to color vision and color vision deficiency (CVD).

Install

cargo add achroma

Usage

use achroma::*;

// Partial blindness to red light
let protanomaly = ColorVision::Protanomaly;
let protanomaly_summary = ConeCellSummary::from(protanomaly);

// query for information of overall CVD
assert_eq!(protanomaly.is_red_green(), true);
assert_eq!(protanomaly.is_anomalous_trichromacy(), true);

// query for individual cone cells by length
assert_eq!(protanomaly_summary.long(),   ConeCellCond::Anomalous);
assert_eq!(protanomaly_summary.medium(), ConeCellCond::Normal);
assert_eq!(protanomaly_summary.short(),  ConeCellCond::Normal);
assert_eq!(protanomaly_summary.is_cone_normal(ConeCell::Long), false);

// query for individual cone cells by color
assert_eq!(protanomaly_summary.red().is_anomalous(), true);
assert_eq!(protanomaly_summary.green(), ConeCellCond::Normal);
assert_eq!(protanomaly_summary['b'].is_normal(), true);
assert_eq!(protanomaly_summary['B'].is_normal(), true);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps