hex_to_rgb

Crates.iohex_to_rgb
lib.rshex_to_rgb
version0.1.3
sourcesrc
created_at2024-10-28 20:29:06.613386
updated_at2024-11-21 01:17:42.412852
descriptionA simple Rust library to convert hex color codes to RGB values.
homepage
repository
max_upload_size
id1426051
size5,939
Ben Santora (bensatlantik)

documentation

https://docs.rs/hex_to_rgb

README

hex_to_rgb

hex_to_rgb is a simple Rust library that converts a hexadecimal color code (in #RRGGBB format) to an RGB tuple ((u8, u8, u8)). This crate is designed for quick, lightweight color conversions, making it useful for applications that work with color manipulation and representation.

Installation

To use hex_to_rgb, add it to your Cargo.toml:

[dependencies] hex_to_rgb = "0.1.0"

Then, in your Rust code:

use hex_to_rgb::hex_to_rgb;

fn main() {
let rgb = hex_to_rgb("#FF5733").unwrap();
println!("The color #FF5733 is represented as RGB {:?}", rgb);
// Outputs: The color #FF5733 is represented as RGB (255, 87, 51)
}

Features

Converts hex color codes (like #RRGGBB) to RGB tuples ((u8, u8, u8)). Lightweight and easy to use. Includes error handling for invalid hex inputs.

License

This project is licensed under the MIT License.

Author

bensatlantik

Commit count: 0

cargo fmt