Add a convinence macro to create a color from a hex code / const function with comptime error
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Creating a color from a hex code. Alternative to having `Color::hex("...").unwrap()` (or `Srgba::hex("...").unwrap()`)
## What solution would you like?
Either:
- A macro to create a color from a hex code without unwraps, compile error if color is invalid.
- A const function with a compiletime error on invalid color, no need to unwrap
Not sure how this fits in with the new color overhaul :P
## What alternative(s) have you considered?
Leave it as is.
Contributor guide
Research direction
Start by reading the existing Color::hex and Srgba::hex APIs and the color overhaul mentioned in the issue. Check how color parsing and compile-time validation are currently tested. Done means a documented way to construct a color from a valid hex code without unwraps, with invalid input rejected at compile time if the chosen approach supports it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100