Crate achroma

source ·
Expand description

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

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);

Structs

  • A discrete representation of the conditions for all three cone cells

Enums

  • Various types of color vision, including normal trichromatic vision and the types of color vision deficiency (CVD)
  • A type of photoreceptor cell which exists in the retina of a vertebrate’s eye, and responsible for color vision
  • The condition (or state of health) for a cone cell