Module:Color contrast: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
better error checking |
||
Line 152: | Line 152: | ||
function p._styleratio(args) |
function p._styleratio(args) |
||
local style = (args[1] or ''):lower() |
local style = (args[1] or ''):lower() |
||
local bg, fg = |
local bg, fg = 'white', 'black' |
||
local lum_bg, lum_fg = 1, 0 |
local lum_bg, lum_fg = 1, 0 |
||
if args[2] then |
|||
local lum = color2lum(args[2]) |
|||
if lum ~= '' then bg, lum_bg = args[2], lum end |
|||
end |
|||
if args[3] then |
|||
local lum = color2lum(args[3]) |
|||
if lum ~= '' then fg, lum_fg = args[3], lum end |
|||
end |
|||
local slist = mw.text.split(style or '', ';') |
local slist = mw.text.split(style or '', ';') |