beeware/toga

HSL to RGB math is incorrect.

Closed this issue · 2 comments

Describe the bug

The HSL to RGB calculation is incorrect for hues in the range 240-330 - it reverses the R and G components.

Steps to reproduce

from travertino.color import hsl

print(hsl(270, 0.75, 0.25))

returns #104070 / rgb(16,64,112).

Expected behavior

It should return #401070 / rgb(64,16,112)

This can be confirmed with https://web-toolbox.dev/en/tools/color-converter

Screenshots

No response

Environment

  • Operating System: All
  • Python version: All
  • Software versions:
    • Toga: 0.5.1

Logs


Additional context

The error appears to be the "h<5" segment of the rgba calculation - it's repeating the <4 math.

Is this resolved by #3585?

Yes; it's been resolved.