12 releases (7 breaking)

0.10.0 Aug 27, 2023
0.9.0 Feb 18, 2023
0.8.0 Oct 24, 2022
0.7.0 Jun 29, 2022
0.4.1 Dec 28, 2021

#376 in Images

Download history 20/week @ 2024-02-22 33/week @ 2024-02-29 19/week @ 2024-03-07 22/week @ 2024-03-14 3/week @ 2024-03-21 7/week @ 2024-03-28

51 downloads per month
Used in 2 crates (via fretboard_layout)

BSD-2-Clause

25KB
751 lines

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.

Example

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);

Dependencies

~0–2MB
~40K SLoC