Module:Color contrast: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
combine
(refactor)
(combine)
Line 73:
-- convert from hsl
if mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*%%[%s]*,[%s]*[0-9][0-9]*%%[%s]*%)$') then
local h, s, l = mw.ustring.match(c,'^hsl%([%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)%%[%s]*,[%s]*([0-9][0-9]*)%%[%s]*%)$')
local s = mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9]*[%s]*,[%s]*([0-9][0-9]*)%%[%s]*,[%s]*[0-9][0-9]*%%[%s]*%)$')
local l = mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*%%[%s]*,[%s]*([0-9][0-9]*)%%[%s]*%)$')
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu