Crate rgba_simple
source · [−]Expand description
Rgba_simple
is a small library for storing colors in RGBA and Hex notation.
It includes functions to convert to and from Hex and RGBA. All of the internal
formats can be serialized and deserialized with serde
. If compiled with the
gdk
feature, all of it’s internal representations can also be converted to
and from gdk::RGBA
, making one use case storing colors generated from
a Gtk+ gui in a config file, using one of the many formats with serde
support.
Use this library if your color needs are simple and you don’t require addressing colors in otherr color spaces, such as CMYK or HSL.
Examples
use rgba_simple::{ReducedRGBA, HexColor, Primary, Convert}
let red = ReducedRGBA::red();
let red_hex = HexColor::red();
assert_eq!(red.to_hex().unwrap(), red_hex);
Structs
This struct contains a color represented in hex notation plus an opacity value. This is necessary to represent colors in an SVG image
This struct represents colors in floating point precision as separate Red, Green, and Blue channels plus a separate Alpha (Opacity) channel
This struct represents colors in 8-bit precision as separate Red, Green, and Blue channels
Enums
An enum
which can represent one of the three color storage types provided
by this library. Implements the Convert
and Primary
traits.
Errors which might occur when validating or converting colors
An enumeration of primary and secondary colors