Module:ContestantColor: Difference between revisions
Appearance
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 | 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 ( | --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 |
Revision as of 22:52, 21 September 2025
Documentation for this module may be created at Module:ContestantColor/doc
p={}
function p.color(frame)
local f=frame~=nil and frame or {args={}}
local colors={ --add contestant colors here
["Black"]="000000",
["Shadow"]="3F3F3F",
["Gray"]="7F7F7F",
["Silver"]="BFBFBF",
["Platinum"]="DFDFDF",
["White"]="FFFFFF",
["Blood"]="3F0000",
["Maroon"]="7F0000",
["Crimson"]="BF0000",
["Red"]="FF0000",
["Strawberry"]="FF3F3F",
["Salmon"]="FF7F7F",
["Vermillion"]="E34234",
["Brick"]="BC4A3C",
["Scarlet"]="FF3F00",
["Coral"]="FF7F50",
["Flame"]="E25822",
["Zinnwaldite"]="2C1608",
["Apricot"]="FBCEB1",
["Copper"]="B87333",
["Chocolate"]="3F1F00",
["Brown"]="7F3F00",
["Tawny"]="806040",
["Tan"]="C09060",
["Bronze"]="CC6600",
["Orange"]="FF7F00",
["Peach"]="FFBF7F",
["Khaki"]="C3B091",
["Goldenrod"]="CF8F00",
["Gold"]="FFBF00",
["Amber"]="E8BE14",
["Olive"]="7F7F00",
["Olivine"]="BFBF00",
["Yellow"]="FFFF00",
["Lemon"]="FFFF3F",
["Cream"]="FFFF7F",
["Ivory"]="FFFFBF",
["Beige"]="F5F5DC",
["Dandelion"]="BFFF00",
["Grass"]="3F7F00",
["Chartreuse"]="7FFF00",
["Ebony"]="555050",
["Nyanza"]="E9FFDB",
["Forest"]="003F00",
["Green"]="007F00",
["Clover"]="00BF00",
["Lime"]="00FF00",
["Spring"]="7FFF7F",
["Moss"]="4C7450",
["Xanadu"]="738678",
["Emerald"]="50C878",
["Mint"]="3FFF7F",
["Shamrock"]="009E60",
["Sea"]="009E60",
["Turquoise"]="00FFBF",
["Teal"]="007F7F",
["Aqua"]="00BFBF",
["Cyan"]="00FFFF",
["Ice"]="7FFFFF",
["Snow"]="DFFFFF",
["Diamond"]="B9F2FF",
["Capri"]="00BFFF",
["Cloud"]="80DFFF",
["Cerulean"]="007BA7",
["Night Sky"]="003F7F",
["Slate"]="708090",
["Sky"]="007FFF",
["Cobalt"]="0047AB",
["Sapphire"]="082567",
["Royal Blue"]="4169E1",
["Azure"]="003FFF",
["Midnight"]="00003F",
["Navy"]="00007F",
["Blue"]="0000FF",
["Periwinkle"]="7F7FFF",
["Ultramarine"]="3F00FF",
["Indigo"]="3F007F",
["Purple"]="5F00BF",
["Lavender"]="7F00FF",
["Amethyst"]="9966CC",
["Alpine"]="BF7FFF",
["Pearl"]="EFDFFF",
["Lilac"]="CB94F7",
["Violet"]="BF00FF",
["Plum"]="7F007F",
["Fuchsia"]="BF00BF",
["Magenta"]="FF00FF",
["Pink"]="FF7FFF",
["Orchid"]="DA70D6",
["Eggplant"]="610051",
["Cerise"]="F504C9",
["Quartz"]="51484F",
["Raspberry"]="7F003F",
["Rose"]="FF007F",
["Telemagenta"]="CF3476",
["Cotton Candy"]="FFBCD9",
["Ruby"]="E0115F",
["Mauve"]="915F6D",
["Burgundy"]="800020",
["Carmine"]="FF0040",
["Amaranth"]="E52B50",
["Monochrome"]="linear-gradient(90deg,#000,#FFF)",
["Rainbow"]="linear-gradient(90deg,#F00,#FF0,#0F0,#0FF,#00F,#F0F,#F00)"
}
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
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 (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
function p.nameMod(name)
if name=="Grey" then name="Gray" end
if name=="Mono" then name="Monochrome" end
return name
end
return p