Add const AlphaColor<sRGB>::from_hex and OpaqueColor<sRGB>::from_hex#217
Merged
Conversation
Merged
DJMcNab
added a commit
to DJMcNab/color
that referenced
this pull request
May 6, 2026
This was released in April 2025, which is now more than a year ago. The reason I want this now is linebender#217, but it does also have user-facing improvements to constness. I used Claude (Opus 4.6) to create the changelog entry.
tomcur
approved these changes
May 14, 2026
tomcur
left a comment
Member
There was a problem hiding this comment.
This is useful, thanks!
Not blocking, but I think having an Rgba8::try_from_hex (and panicking counterpart) would be nicely symmetrical, where the AlphaColor<Srgb> method internally forwards to that and uses AlphaColor<Srgb>::from_rgba8. The parsing function color_from_4bit_hex effectively does something like that already.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a rework of #212.
Many thanks to @l0uisgrange for kicking this off. I look forward to seeing your review.
I used Claude (Opus 4.6) to review (but not write) the docs entry, and to write a first version of the tests.