iro 0.0.1

Conversion between color spaces.
Documentation
  • Coverage
  • 9.68%
    3 out of 31 items documented0 out of 7 items with examples
  • Size
  • Source code size: 18.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.9 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • TianyiShi2001

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".