Module:Color contrast: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(Created page with '-- -- This module implements -- {{Color contrast ration}} -- {{ColorToLum}} -- {{RGBColorToLum}} -- local p = {} local function sRGB ( v ) if (v <= 0.0392...')
 
No edit summary
Line 118: Line 118:


function p.ratio(frame)
function p.ratio(frame)
local v1 = color2num(frame.args[1] or frame:getParent().args[1])
local v1 = color2lum(frame.args[1] or frame:getParent().args[1])
local v2 = color2num(frame.args[2] or frame:getParent().args[2])
local v2 = color2lum(frame.args[2] or frame:getParent().args[2])
return (v2 + 0.05)/(v1 + 0.05)
return (v2 + 0.05)/(v1 + 0.05)
end
end