Thank you so much SimonLarsen! This is what i was looking for!
But your code increases or decreases the hue automatically, so i sightly modified it to change the hue manually like this:
Code: Select all
function HSL(h, s, l, a)
if s<=0 then return l,l,l,a end
h, s, l = h/256*6, s/255, l/255
local c = (1-math.abs(2*l-1))*s
local x = (1-math.abs(h%2-1))*c
local m,r,g,b = (l-.5*c), 0,0,0
if h < 1 then r,g,b = c,x,0
elseif h < 2 then r,g,b = x,c,0
elseif h < 3 then r,g,b = 0,c,x
elseif h < 4 then r,g,b = 0,x,c
elseif h < 5 then r,g,b = x,0,c
else r,g,b = c,0,x
end return (r+m)*255,(g+m)*255,(b+m)*255,a
end
function love.load()
hue = 0
end
function love.update(dt)
if hue > 255 then hue = 0
elseif hue < 0 then hue = 255 end
if love.keyboard.isDown('1') then hue = hue +10*dt end
if love.keyboard.isDown('2') then hue = hue -10*dt end
end
function love.draw()
love.graphics.setColor(HSL(hue,255,128))
love.graphics.rectangle("fill",0,0,800,600)
love.graphics.setColor(255,255,255,255)
love.graphics.print("Hue: "..hue, 16,16)
end
So thanks to you, i won't go bald & insane...LOL!!!
