| Crates.io | all-colors |
| lib.rs | all-colors |
| version | 0.0.6 |
| created_at | 2023-06-19 05:51:29.955966+00 |
| updated_at | 2024-01-09 02:42:10.318657+00 |
| description | Utility crate for getting color hex values. |
| homepage | |
| repository | https://github.com/miketwenty1/all-colors/ |
| max_upload_size | |
| id | 893834 |
| size | 37,568 |
rust crate for converting a &str into a hex string
get_color_hex takes in a &str and will return a 6 char hex string.
fn main() {
use all_colors::get_color_hex;
//EXAMPLES:
let color_hex = get_color_hex("aqua").expect("well known color name");
let color_hex2 = get_color_hex("give me something interesting").expect("some random color a4f662");
let color_hex3 = get_color_hex("f20").expect("f00 will return ff2200");
let color_hex4 = get_color_hex("010255001").expect("9 digits will become 0aff01");
println!("aqua is #{}", color_hex);
}