Module:DifficultyColor

local p = {}

local color = { -- using current colors for now ["None"] = {'Black', 'White'}, ["Very Easy"] = {'Black', 'Cyan'}, ["Easy"] = {'White', 'Teal'}, ["Somewhat Easy"] = {'White', 'Blue'}, ["Medium"] = {'Black', 'Salmon'}, ["Somewhat Hard"] = {'White', 'Purple'}, ["Hard"] = {'Black', 'Violet'}, ["Very Hard"] = {'Black', 'Red'}, ["Insanely Hard"] = {'White', 'Black'}, ["Impossible"] = {'Black', 'Grey'} }

local function _getColor( difficulty, forecolor ) local i = 2 local myColor = '' if forecolor then i = 1 end myColor = color[difficulty] if myColor then return myColor[i] else return '' end end function p.getColor( frame ) local a = frame.args local difficulty = a[1] -- mixed case difficulty, eg. "Very Hard" local forecolor = a[2] and not (a[2] == '') -- if second param present, get forecolor, else backcolor

return _getColor(difficulty, forecolor) end return p