Module:Color contrast: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
fix
(refactor to allow this to be called from another module)
(fix)
Line 122:
end
 
local function colors2ratio(c1,c2c)
local v1 = color2lum(c1c[1])
local v2 = color2lum(c2c[2])
if (type(v1) == 'number' and type(v2) == 'number') then
return (v2 + 0.05)/(v1 + 0.05)
Line 137:
 
function p.ratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args[1],
local r = colors2ratio(args)
frame.args[1] or frame:getParent().args[1],
frame.args[2] or frame:getParent().args[2]
)
if (r ~= '') then
return r
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu