11 releases (6 breaking)

0.9.0 Feb 18, 2023
0.8.0 Oct 24, 2022
0.7.0 Jun 29, 2022
0.5.1 Feb 13, 2022
0.4.1 Dec 28, 2021

#181 in Images

Download history 15/week @ 2022-12-01 43/week @ 2022-12-08 21/week @ 2022-12-15 23/week @ 2022-12-22 24/week @ 2022-12-29 11/week @ 2023-01-05 15/week @ 2023-01-12 28/week @ 2023-01-19 21/week @ 2023-01-26 35/week @ 2023-02-02 25/week @ 2023-02-09 78/week @ 2023-02-16 34/week @ 2023-02-23 20/week @ 2023-03-02 25/week @ 2023-03-09 20/week @ 2023-03-16

116 downloads per month
Used in 2 crates

BSD-2-Clause

24KB
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

~225KB