rgb 0.3.0

struct RGB for sharing pixels between crates
Documentation

struct RGB for Rust

Rust is strongly typed and your RGB pixel is not compatible with my RGB pixel.

So let's all use mine :P

extern crate rgb;

let px = RGB{r:255_u8,g:0,b:100};
assert_eq!(px.as_bytes()[0], 255);

let px = RGB8::new(255,0,255);
let inverted = px.map(|ch| 255 - ch);

println!("{}", inverted); // rgb(0,255,0)

xkcd standards