iro

Crates.ioiro
lib.rsiro
version0.0.1
sourcesrc
created_at2020-10-10 18:29:23.482344
updated_at2020-10-10 18:29:23.482344
descriptionConversion between color spaces.
homepage
repositoryhttps://github.com/TianyiShi2001/iro
max_upload_size
id298115
size18,979
Tianyi Shi (TianyiShi2001)

documentation

README

iro — Representing Colors in Rust

crates.io crates.io crates.io

Goals

  • Representation of colors in different color spaces
  • Conversion of colors between color spaces

and nothing else.

Example

use iro::{Cmyk, CmykInt, Hsl, HslInt, Rgb};

use iro::{Cmyk, CmykInt, Hsl, HslInt, Rgb};

fn main() {
    let color = Rgb::new(85, 191, 100);
    println!("{:?}", &color);
    let color: Cmyk = color.into();
    println!("{:?}", &color);
    let color: CmykInt = color.into();
    println!("{:?}", (color.c, color.m, color.y, color.k));
    println!("{:?}", &color);
    let color = Hsl::from(Rgb::from(color));
    println!("{:?}", &color);
    let color: HslInt = color.into();
    println!("{:?}", &color);
}

// Rgb { r: 85, g: 191, b: 100 }
// Cmyk { c: 0.5549738, m: 0.0, y: 0.47643983, k: 0.25098038 }
// (55, 0, 48, 25)
// CmykInt { c: 55, m: 0, y: 48, k: 25 }
// Hsl { h: 127.42857, s: 0.45064378, l: 0.54313725 }
// HslInt { h: 127, s: 45, l: 54 }

About the name

iro (色) is the Japanese word for "color".

Commit count: 0

cargo fmt