colorverse 0.4.0

color vision convertor
Documentation

Colorverse

Color vision convertor / simluator

Based on Machado, Oliveira & Fernandes (2009) model. Customized with dynamic level parameter introduced and nonlinear easing of the level.

Usage

Configure:

$ cargo add colorverse

Use:

use colorverse::convert;
use colorverse::core::color_vision::color_vision_type::ColorVisionType;

let color_vision_type = ColorVisionType::Protanomaly;
let level = 0.5;
let input_file_path = "input.png";
let output_file_path = format!("output-{}-{}.png", color_vision, level * 100.0);

convert(input_file_path, &color_vision, level)
    .unwrap()
    .save_as(output_file_path.as_str());
use colorverse::convert;
use colorverse::core::color_vision::color_vision_type::ColorVisionType;

let mut color_vision_type_iterator = ColorVisionTypeIterator::new(&ColorVisionType::Trichromacy);
while let Some(color_vision_type) = color_vision_type_iterator.next() {
    for level in [0.5, 1.0] {
        match convert("input.png", &color_vision_type, level) {
            Ok(x) => {
                let output_file_path = format!("output-{}-{}.png", &color_vision_type, level * 100.0);
                x.save_as(output_file_path.as_str());
            }
            Err(err) => eprintln!("{}", err),
        }
    }
}

Samples

Trichromacy

trichromacy

Protanomaly 50%

protanomaly

Protanomaly 100% (Protanopia)

protanopia

Deuteranomaly 50%

deuteranomaly

Deuteranomaly 100% (Deuteranopia)

deuteranopia

Tritanomaly 50%

tritanomaly

Tritanomaly 100% (Tritanopia)

tritanopia

Achromatomaly 50%

achromatomaly

Achromatomaly 100% (Achromatopsia)

achromatopsia


Open-source, with care

This project is lovingly built and maintained by volunteers.
We hope it helps streamline your work.
Please understand that the project has its own direction — while we welcome feedback, it might not fit every edge case 🌱

Acknowledgements

Depends on image / nalgebra. Also, on argh on CLI I/F.