Module:To-do/type

-- local p = {}; local data = mw.loadData("Module:To-do/type/data") local title = mw.title.getCurrentTitle local colors = require("Dev:Colors")

function p.type(frame) local args = frame:getParent.args local s = args[1] or "" local k = mw.ustring.lower(s) local o = nil local style = "padding:2px 6px;border-radius:4px;display:inline-block;" .. "font-weight:bold;text-transform:uppercase;font-size:8pt;" if data[k] and k then o = data[k] else o = data["unknown"] end local color = o.color or "" if not color then color = data["unknown"].color end local textColor = "" local isBright = nil local c = colors.parse(color) local b = c:bright if b then textColor = "#000000" else textColor = "#ffffff" end style = style .. "background-color:" .. color .. ";"   style = style .. "color:" .. textColor .. ";"   local name = o.name or "" local html = ' ' .. name .. " "    return html end

return p