Module:Utils

-- Written by User:YouFoundJojo -- Contains functions used by various templates and pages

local p = {}

-- Hex -> RGB/A function p.HexToRGB(frame) if not frame.args[1] then return "#000" end local hex = frame.args[1]:gsub("#","") if #hex == 3 then hex = hex:rep(2) end local a = frame.args[2] or 0 local r = tonumber("0x"..hex:sub(1,2)) local g = tonumber("0x"..hex:sub(3,4)) local b = tonumber("0x"..hex:sub(5,6)) return 'rgba('..r..', '..g..', '..b..', '.. a ..')' end

return p