Jump to content

Module:ContestantColor: Difference between revisions

MisterChuChu (talk | contribs)
Swapped text colors of Magenta and Olivine to make them easier to see
MisterChuChu (talk | contribs)
Added special color support
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)"
}
}
return (f.args[2]~=nil and f.args[2] or "#")..(colors[p.nameMod(f.args[1]~=nil and f.args[1] or "")] or "000000")
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")
end
end


function p.text(frame)
function p.text(frame)
local f=frame~=nil and frame or {args={}}
local f=frame~=nil and frame or {args={}}
local black={ --add contestants whose text colors should be black instead of white
local modif={ --1=black, 2=white with black outline, 3=black with white outline
["Silver"]=1,
["Silver"]=1,
["Platinum"]=1,
["Platinum"]=1,
Line 146: Line 148:
["Pink"]=1,
["Pink"]=1,
["Cerise"]=1,
["Cerise"]=1,
["Cotton Candy"]=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 (black[p.nameMod(f.args[1]~=nil and f.args[1] or "")]~=nil and "black" or "white")
--return (modif[p.nameMod(f.args[1]~=nil and f.args[1] or "")]~=nil and "black" or "white")
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
end


function p.nameMod(name)
function p.nameMod(name)
if name=="Grey" then name="Gray" end
if name=="Grey" then name="Gray" end
if name=="Mono" then name="Monochrome" end
return name
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.