Module:Color contrast: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(fix) |
(fix) |
||
Line 122: | Line 122: | ||
end |
end |
||
function p._ratio(args) |
|||
local v1 = color2lum(c[1]) |
local v1 = color2lum(c[1]) |
||
local v2 = color2lum(c[2]) |
local v2 = color2lum(c[2]) |
||
Line 128: | Line 128: | ||
return (v2 + 0.05)/(v1 + 0.05) |
return (v2 + 0.05)/(v1 + 0.05) |
||
else |
else |
||
return '' |
return args['error'] or '?' |
||
end |
end |
||
end |
end |
||
Line 138: | Line 138: | ||
function p.ratio(frame) |
function p.ratio(frame) |
||
local args = frame.args[1] and frame.args or frame:getParent().args |
local args = frame.args[1] and frame.args or frame:getParent().args |
||
return p._ratio(args) |
|||
if (r ~= '') then |
|||
return r |
|||
else |
|||
return frame.args['error'] or frame:getParent().args['error'] or '?' |
|||
end |
|||
end |
end |
||