Module:ColorConverter

local p = {}

function p.getNumber(frame) return tonumber(string.gsub(frame.args.color, "#", ""), 16) end

function p.getRed(frame) return tonumber(string.sub(frame.args.color, 2,3), 16) end

function p.getGreen(frame) return tonumber(string.sub(frame.args.color, 4,5), 16) end

function p.getBlue(frame) return tonumber(string.sub(frame.args.color, 6,7), 16) end

function p.getColorFromSeperate(frame) return string.upper(string.format("#%02x%02x%02x", frame.args.red, frame.args.green, frame.args.blue)) end

function p.getColor(frame) return string.upper(string.format("#%06x", frame.args.color)) end

return p