Crates.io | rgba_simple |
lib.rs | rgba_simple |
version | 0.10.0 |
source | src |
created_at | 2021-12-10 17:27:11.645838 |
updated_at | 2023-08-27 04:14:48.624866 |
description | Simple RGBA and Hex color representation |
homepage | https://jeang3nie.codeberg.page |
repository | https://codeberg.org/jeang3nie/rgba-simple |
max_upload_size | |
id | 495806 |
size | 36,637 |
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.
use rgba_simple::*;
let red_hex = String::from("#ff0000");
let red: RGB::<u8> = PrimaryColor::Red.into();
assert_eq!(RGB::<u8>::from_hex(&red_hex), red);