[go: up one dir, main page]

color-hex 0.2.0

Procedural macro for converting hexadecimal strings to an RGB or RGBA byte array at compile time.
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 11.22 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 260.11 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • newcomb-luke/color-hex
    7 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • newcomb-luke

color-hex

A small Rust crate that supplies procedural macros to convert hex strings into RGB/A colors at compile time.

GitHub Workflow Status Crates.io

Documentation

The documentation includes a comprehensive description of the syntax supported for parsing hex colors.

Usage

Add this to your Cargo.toml:

[dependencies]
color_hex = "0.2.0"

Here is an example of converting a direct "HTML style" hex color string to an array:

use color_hex::color_from_hex;

fn main() {
    let color = color_from_hex!("#2d2d2d");

    println!("Color: {:x?}", color);
}

License

Licensed under the MIT license

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 licensed as above, without any additional terms or conditions.