Jump to content

Module:ContestantColor: Difference between revisions

MisterChuChu (talk | contribs)
Returns a contestant's corresponding hex color code
 
MisterChuChu (talk | contribs)
Added text color function
Line 2: Line 2:
function p.color(frame)
function p.color(frame)
local f=frame~=nil and frame or {args={}}
local f=frame~=nil and frame or {args={}}
local colors={
local colors={ --add contestant colors here
["Black"]="000000",
["Black"]="000000",
["Shadow"]="3F3F3F",
["Shadow"]="3F3F3F",
Line 106: Line 106:
}
}
local a=f.args[1]~=nil and f.args[1] or ""
return (f.args[2]~=nil and f.args[2] or "#")..(colors[p.nameMod(f.args[1]~=nil and f.args[1] or "")] or "000000")
if a=="Grey" then a="Gray" end
end
 
function p.text(frame)
local f=frame~=nil and frame or {args={}}
local black={ --add contestants whose text colors should be black instead of white
["Silver"]=1,
["Platinum"]=1,
["White"]=1,
["Salmon"]=1,
["Coral"]=1,
["Apricot"]=1,
["Peach"]=1,
["Gold"]=1,
["Amber"]=1,
["Yellow"]=1,
["Lemon"]=1,
["Cream"]=1,
["Ivory"]=1,
["Beige"]=1,
["Dandelion"]=1,
["Chartreuse"]=1,
["Nyanza"]=1,
["Lime"]=1,
["Spring"]=1,
["Mint"]=1,
["Turquoise"]=1,
["Cyan"]=1,
["Ice"]=1,
["Snow"]=1,
["Diamond"]=1,
["Capri"]=1,
["Cloud"]=1,
["Periwinkle"]=1,
["Alpine"]=1,
["Pearl"]=1,
["Lilac"]=1,
["Magenta"]=1,
["Pink"]=1,
["Cerise"]=1,
["Cotton Candy"]=1
}
return (black[p.nameMod(f.args[1]~=nil and f.args[1] or "")]~=nil and "black" or "white")
end
 
function p.nameMod(name)
if name=="Grey" then name="Gray" end
return (f.args[2]~=nil and f.args[2] or "#")..(colors[a] or "000000")
return name
end
end
return p
return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.