Module:AB2 rank colors

local getArgs = require('Module:Common').getArgs

-- HTML colors: https://www.w3.org/TR/css-color-3/#svg-color local HTMLColors = { ['vanilla'] = 'powderblue', ['bronze'] = 'goldenrod', ['silver'] = 'silver', ['gold'] = 'gold', ['azure'] = 'slateblue', ['emerald'] = 'mediumseagreen', ['amethyst'] = 'plum', ['diamond'] = 'aquamarine', ['legendary'] = 'darkorange', }

local materialKeys = { 'bronze', 'silver', 'gold', 'azure', 'emerald', 'amethyst', 'diamond', }

local p = {}

p.getHTMLColor = function(frame) local args = getArgs(frame) local key = string.lower(args[1]) return HTMLColors[key] end

p.getHTMLColorByRank = function(frame) local args = getArgs(frame) local rank = tonumber(args[1]) if rank <= 1 then return HTMLColors['vanilla'] elseif rank >= 51 then return HTMLColors['legendary'] else -- rank >= 2, rank <= 50 return HTMLColors[materialKeys[(rank - 2) % 7 + 1]] end end

return p