mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 14:14:36 +00:00
parent
5df717fe6d
commit
f5eda744b9
@ -134,8 +134,9 @@ function colour.rgb_to_hsl(r, g, b)
|
|||||||
if max == min then return 0, 0, min end
|
if max == min then return 0, 0, min end
|
||||||
|
|
||||||
local l, d = max + min, max - min
|
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
|
l = l / 2
|
||||||
|
local h = nil --depends on below
|
||||||
if max == r then
|
if max == r then
|
||||||
h = (g - b) / d
|
h = (g - b) / d
|
||||||
if g < b then h = h + 6 end
|
if g < b then h = h + 6 end
|
||||||
|
Loading…
Reference in New Issue
Block a user