Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/newcomb-luke/color-hex
A small Rust crate that supplies procedural macros to convert hex strings into RGB/A colors at compile time.
https://github.com/newcomb-luke/color-hex
Last synced: about 1 month ago
JSON representation
A small Rust crate that supplies procedural macros to convert hex strings into RGB/A colors at compile time.
- Host: GitHub
- URL: https://github.com/newcomb-luke/color-hex
- Owner: newcomb-luke
- License: mit
- Created: 2022-05-07T02:51:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-02T15:18:40.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T15:10:07.331Z (8 months ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# color-hex
A small Rust crate that supplies procedural macros to convert hex strings into RGB/A colors at compile time.![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/newcomb-luke/color-hex/main.yml)
![Crates.io](https://img.shields.io/crates/v/color-hex)## Documentation
[The documentation](https://docs.rs/color-hex) includes a comprehensive description of the syntax supported for parsing hex colors.
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
color_hex = "0.2.0"
```Here is an example of converting a direct "HTML style" hex color string to an array:
```Rust
use color_hex::color_from_hex;fn main() {
let color = color_from_hex!("#2d2d2d");println!("Color: {:x?}", color);
}
```## License
Licensed under the [MIT license](http://opensource.org/licenses/MIT)
## 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.