clarified declaration of h in colour.rgb_to_hsl

fixes #43
This commit is contained in:
Max Cahill 2021-11-23 10:40:57 +11:00
parent 5df717fe6d
commit f5eda744b9

View File

@ -134,8 +134,9 @@ function colour.rgb_to_hsl(r, g, b)
if max == min then return 0, 0, min end
local l, d = max + min, max - min
local s, h = d / (l > 1 and (2 - l) or l)
local s = d / (l > 1 and (2 - l) or l)
l = l / 2
local h = nil --depends on below
if max == r then
h = (g - b) / d
if g < b then h = h + 6 end