inku

An RGBA color backed by a u32.

Examples

```rust type RGBA = inku::Color;

let color = RGBA::new(0x000000ff); let new_color = color // Lighten the color by 10% .lighten(0.1) // Saturate the color by 30% .saturate(0.3);

asserteq!(newcolor.to_u32(), 0x201111ff); ```

Storage Formats

An RGBA color backed by a u32.

There are multiple storage formats to choose from, [ZRGB] and [RGBA]. These determine how the underlying u32 is laid out.

```rust type RGBA = inku::Color; type ZRGB = inku::Color;

asserteq!(RGBA::new(0xfacadeff).tou32(), 0xfacadeff);

// NOTE: The high two bytes are zeroed out asserteq!(ZRGB::new(0xfffacade).tou32(), 0x00facade); ```

Manipulations are lossy

Because we're representing the colour with a u32, manipulations are not reversible. Consider the following:

```rust type RGBA = inku::Color; let color = RGBA::new(0xfacadeff);

// We convert the RGB values to HSL and desaturated the color let desaturatedcolor = color.desaturate(0.1); asserteq!(0xf7ccdeff, desaturatedcolor.tou32());

// We don't know what our original hue was, so we can't get back to the original color let resaturatedcolor = desaturatedcolor.saturate(0.1); asserteq!(0xf9c9ddff, resaturatedcolor.to_u32()); ```

License: MIT OR Apache-2.0