linebender / resvg

An SVG rendering library.
Apache License 2.0
2.84k stars 229 forks source link

HSL color incorrectly translates to RGB color #786

Open woodroof opened 4 months ago

woodroof commented 4 months ago

For example, hsl(230, 57%, 54%) should be translated to #475dcd, but usvg returns #465dcc. r component value is 70.839, so it should be rounded to 71 (0x47).

RazrFalcon commented 4 months ago

I'm not sure I would call it "incorrectly". Just a different rounding to what you're expecting. It's not a lossless operation to begin with.

woodroof commented 4 months ago

Maybe "incorrectly" is not a right word, but still usvg selects not a closest rgb color, and that can be improved.

woodroof commented 4 months ago

I can make a PR if you show me a place where this transformation is happening.

RazrFalcon commented 4 months ago

+/-1 difference is perfectly normal. But Chrome seems to be rounding up, so should we. Will fix in the next update.