Module:In-Game Colors

-- Key/value pairs are stored here local arr = { -- Damage Types ["Energy"] = "FFFF33", ["Explosive"] = "FF6600", ["Kinetic"] = "0099FF", ["Alien"] = "37FCAC", ["Plasma"] = "FF66FF", ["Blight"] = "777777", ["Void"] = "A26AFF",

-- Rarity Types ["Common"] = "D4F8FF", ["Uncommon"] = "7EBB5A", ["Rare"] = "39C6FD", ["Epic"] = "A26AFF", ["Legendary"] = "FF9500",

-- Factions ["Miner Rebellion"] = "8D8D8D", ["Rebel"] = "8D8D8D", ["VEGA Mining"] = "2B69A8", ["VEGA"] = "2B69A8", ["VEGA Security"] = "FF5959", ["VSec"] = "2B69A8", ["Iron Star Company"] = "82A65A", ["Iron Star"] = "82A65A", ["Demon Corps"] = "C12626", ["Aliens"] = "61C382", ["Xeno Division"] = "89EE4F", ["A.X.I.S."] = "C49B62", ["AXIS"] = "C49B62", ["Marauders"] = "7A00C8", ["Marauder"] = "7A00C8", ["Altairians"] = "FFDE7A", ["Altairian"] = "FFDE7A", ["Umbra"] = "72462B", ["Pharmakon"] = "24FFFF", ["Spectre"] = "666666", ["Liberatus"] = "39F0CB", -- Stats and Modifiers ["Statistic"] = "FEB559", ["Bonus"] = "4CFF00", ["Penalty"] = "FE5959" }

-- Module call from Template:In-Game Colors function getColorCode( frame ) local args = require("Module:Args").getCleanArgs

local key = assert(args[1], "Missing argument #1") local isDark = args[2] or "0" local hex = arr[key] if hex == nil then error(string.format("Argument #1 (%s) is not a valid key", key)) end

-- Optionally darkens the color by 50% if isDark == "0" then return "#" .. hex else r = string.format("%X", tonumber(hex:sub(1, 2), 16) / 2) if r == "0" then r = "00" end

g = string.format("%X", tonumber(hex:sub(3, 4), 16) / 2) if g == "0" then g = "00" end

b = string.format("%X", tonumber(hex:sub(5, 6), 16) / 2) if b == "0" then b = "00" end

return "#" .. r .. g .. b	end end

return { getColorCode = getColorCode }