Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rgb::from_hex and implement parsing for u16, u32, f32, f64 #424

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Nov 16, 2024

This expands hexadecimal parsing for Rgb to support more component types (u16, u32, f32, f64) and add an easier to find from_hex constructor for both Rgb and Rgba. It also updates component conversion when increasing bit depth to not convert via floating point types.

Closed Issues

Type Inference Breaking Change

This affects type inference by making Srgb::from_str(hex)?.into_format() and similar situations ambiguous. This example can be resolved by either specifying the component type or removing .into_format().

Copy link

codspeed-hq bot commented Nov 16, 2024

CodSpeed Performance Report

Merging #424 will not alter performance

Comparing more_hex (d626898) with master (8e22189)

Summary

✅ 47 untouched benchmarks

Copy link

codecov bot commented Nov 16, 2024

Codecov Report

Attention: Patch coverage is 81.59722% with 53 lines in your changes missing coverage. Please review.

Project coverage is 82.63%. Comparing base (8e22189) to head (d626898).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #424      +/-   ##
==========================================
+ Coverage   82.61%   82.63%   +0.01%     
==========================================
  Files         130      131       +1     
  Lines       20254    20485     +231     
  Branches    20254    20485     +231     
==========================================
+ Hits        16733    16927     +194     
+ Misses       3383     3378       -5     
- Partials      138      180      +42     
Components Coverage Δ
palette 82.68% <81.59%> (+0.01%) ⬆️
palette_derive 81.98% <ø> (ø)

@Ogeon Ogeon merged commit 234309c into master Nov 17, 2024
22 of 23 checks passed
@Ogeon Ogeon deleted the more_hex branch November 17, 2024 13:45
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.

Parsing hex strings as Rgb<f32> and Rgb<f64> Function to parse both hex and named colours from a string
1 participant