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

hwb parsing and rounding #104

Open
waywardmonkeys opened this issue Dec 21, 2024 · 1 comment
Open

hwb parsing and rounding #104

waywardmonkeys opened this issue Dec 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@waywardmonkeys
Copy link
Collaborator

In the WPT, there's a test for parsing hwb(120 30% 50%) which says it should return rgb(77, 128, 77).

Instead, it returns rgb(76, 128, 76) using this code:

let check_color = parse_color(check).unwrap().to_alpha_color::<Srgb>().to_rgba8();
let result_color = parse_color(result).unwrap().to_alpha_color::<Srgb>().to_rgba8();
assert_eq!(check_color, result_color);
@waywardmonkeys waywardmonkeys added the bug Something isn't working label Dec 21, 2024
@raphlinus
Copy link
Contributor

This is an unfortunate case in WPT, as the actual value is 76.5 127.5 76.5. It is likely caused by our use of multiplication by (1. / 255.). I don't think this is a reasonable thing to test, for example GPUs will likely get it wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants