Crates.io | achroma |
lib.rs | achroma |
version | 0.1.0 |
source | src |
created_at | 2023-10-30 04:28:14.557333 |
updated_at | 2023-10-30 04:28:14.557333 |
description | A tiny crate for encoding data related to color vision and color vision deficiency (CVD) |
homepage | https://github.com/neoncitylights/achroma |
repository | https://github.com/neoncitylights/achroma |
max_upload_size | |
id | 1018046 |
size | 45,885 |
A tiny crate for encoding data related to color vision and color vision deficiency (CVD).
cargo add achroma
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);
Licensed under either of
LICENSE-APACHE
or http://www.apache.org/licenses/LICENSE-2.0)LICENSE-MIT
or http://opensource.org/licenses/MIT)at your option.
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.