Skip to content

Add const AlphaColor<sRGB>::from_hex and OpaqueColor<sRGB>::from_hex#217

Merged
DJMcNab merged 11 commits into
linebender:mainfrom
DJMcNab:hex-color-update
May 21, 2026
Merged

Add const AlphaColor<sRGB>::from_hex and OpaqueColor<sRGB>::from_hex#217
DJMcNab merged 11 commits into
linebender:mainfrom
DJMcNab:hex-color-update

Conversation

@DJMcNab

@DJMcNab DJMcNab commented May 6, 2026

Copy link
Copy Markdown
Member

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.

@DJMcNab DJMcNab mentioned this pull request May 6, 2026
@DJMcNab DJMcNab force-pushed the hex-color-update branch from 8bcb4e9 to 4bf0fd0 Compare May 6, 2026 00:30
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.
@DJMcNab DJMcNab force-pushed the hex-color-update branch from 4bf0fd0 to 0b6430d Compare May 6, 2026 21:49

@tomcur tomcur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread color/src/lib.rs
@DJMcNab DJMcNab force-pushed the hex-color-update branch from e238584 to 1fb5dd0 Compare May 21, 2026 13:09
@DJMcNab DJMcNab added this pull request to the merge queue May 21, 2026
Merged via the queue into linebender:main with commit ed04383 May 21, 2026
16 checks passed
@DJMcNab DJMcNab deleted the hex-color-update branch May 21, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants