hex_color 1.0.0

A Rust library for parsing, serializing, and operating on hex colors.
Documentation

hex_color

A Rust library for parsing, serializing, and operating on hex colors.

Build Status Latest Version

Documentation

Module documentation with examples. The module documentation also includes a comprehensive description of the syntax supported for parsing hex colors.

Usage

Add this to your Cargo.toml:

[dependencies]
hex_color = "1.0"

Here's a simple example that matches a hex color and prints the value of the red, green, and blue components:

use hex_color::HexColor;

fn main() {
    let s = "#789ABC";
    let color: HexColor = s.parse();
    println!("rgb({}, {}, {})", color.r, color.g, color.b);
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.