achroma

Crates.ioachroma
lib.rsachroma
version0.1.0
sourcesrc
created_at2023-10-30 04:28:14.557333
updated_at2023-10-30 04:28:14.557333
descriptionA tiny crate for encoding data related to color vision and color vision deficiency (CVD)
homepagehttps://github.com/neoncitylights/achroma
repositoryhttps://github.com/neoncitylights/achroma
max_upload_size
id1018046
size45,885
Samantha (neoncitylights)

documentation

https://docs.rs/achroma/

README

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.

Commit count: 11

cargo fmt