Jump to content

Module:ContestantColor: Difference between revisions

MisterChuChu (talk | contribs)
Returns a contestant's corresponding hex color code
 
MisterChuChu (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
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 103: Line 103:
["Burgundy"]="800020",
["Burgundy"]="800020",
["Carmine"]="FF0040",
["Carmine"]="FF0040",
["Amaranth"]="E52B50"
["Amaranth"]="E52B50",
["Monochrome"]="linear-gradient(90deg,#000,#FFF)",
["Rainbow"]="linear-gradient(90deg,#F00,#FF0,#0F0,#0FF,#00F,#F0F,#F00)"
}
}
local a=f.args[1]~=nil and f.args[1] or ""
return (p.autoHex({args={f.args[1]}}) and (f.args[2]~=nil and f.args[2] or "#") 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 modif={ --1=black, 2=white with black outline, 3=black with white outline
["Silver"]=1,
["Platinum"]=1,
["White"]=1,
["Salmon"]=1,
["Coral"]=1,
["Apricot"]=1,
["Peach"]=1,
["Gold"]=1,
["Amber"]=1,
["Olivine"]=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,
["Pink"]=1,
["Cerise"]=1,
["Cotton Candy"]=1,
["Rainbow"]=2
}
local res={
"#000",
"#FFF;text-shadow:-1px -1px 1px #000,1px -1px 1px #000,-1px 1px 1px #000,1px 1px 1px #000",
"#000;text-shadow:-1px -1px 1px #FFF,1px -1px 1px #FFF,-1px 1px 1px #FFF,1px 1px 1px #FFF"
}
return res[modif[p.nameMod(f.args[1]) or ""]] or "#FFF"
end
 
function p.autoHex(frame)
local noHex={
["Monochrome"]=1,
["Rainbow"]=1
}
return noHex[p.nameMod(frame.args[1])]==nil
end
 
function p.nameMod(name)
if name=="Grey" then name="Gray" end
if name=="Mono" then name="Monochrome" 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.