Crates.io | named-colour |
lib.rs | named-colour |
version | 0.3.5 |
source | src |
created_at | 2021-09-29 17:22:47.15013 |
updated_at | 2024-11-01 21:05:16.958787 |
description | named-colour provides Hex Codes for popular colour names. |
homepage | |
repository | https://github.com/jerus-org/named-colour |
max_upload_size | |
id | 458222 |
size | 152,485 |
The rust library named-colour provides a convenient set of named colours and the Hex Code for each colour.
To use named-colour in your project you can add the following to your Cargo.toml
:
[dependencies]
named-colour = "0.3.5"
Provides Hex Codes for colours:
use named_colour::Basic;
println!("The colour Hex Code is: {} for the RGB colour Aqua: {}",
Basic::Aqua,
Basic::Aqua.as_rgb()
);
Enable the feature in the toml file:
[dependencies]
named-colour = { version = "0.3.5", features = ["extended"]}
use named_colour::ext::Indigo;
println!("The colour Hex Code is: {} for the RGB colour Dark Orchid: {}",
Indigo::DarkOrchid,
Indigo::DarkOrchid.as_rgb()
);
use named_colour::ColourRgb;
let my_colour =ColourRgb::new(12,24,48);
println!("The Hex Code is: {} for my_colour: {}",
my_colour.as_hex(),
my_colour.to_string()
);
To use the extended colour set only configure toml with no-default features
[dependencies]
named-colour = { version = "0.3.5", default_features = false, features = ["extended"]}
Licensed under either of
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.