Module:College color/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
rm unnecessary function
Jackmcbarn (talk | contribs)
rm unnecessary string.lower() and unnecessary "or ''"s
Line 17:
end
local function color2lum( origc )
local c = mw.text.trim(origc or ''):lower()
 
-- remove leading # (if there is one)
c = mw.ustring.match(c, '^[#]*([aA-Fa-f0-9]*)$')
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R = sRGB( (16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2]))/255 )