Crate keyset_color

source ·
Expand description

This crate contains the Color type implementation used internally in keyset.

But why not use an existing crate like rgb???

rgb has great storage containers for colours, and many convenience methods for converting between different pixel formats. Unfortunately one thing it doesn’t do well is convert between different component types. For example From<RGB<f32>> is implemented for RGB<u8> but the conversion does not scale the component ranges.

Keyset uses several different libraries internally and multiple different component types. This crate is designed to scale 0.0f32..1.0f32 to 0u8..255u8 and 0u16..65535u16 as is commonly expected. It also provides conversion traits to RGB<u8>, RGB<u16>, and RGB<f32> for interoperability; and supports direct conversion to other colour types used by dependencies of keyset.

Structs