Module:Sandbox/Adorable Newcomer/test
跳到导航
跳到搜索
local getArgs = require("Module:Arguments").getArgs local p = {} local color_data = mw.loadData("Module:Sandbox/Adorable_Newcomer/test/data") function p.name(color) return color_data[string.upper(color or '')] or 'null' end p.color = p.name function p._colorbox(color, firstColor, secondColor, note) local colorBackground = color or string.format("linear-gradient(%s 50%%,%s 50%%)", firstColor, secondColor) local title = note if not note then if color then title = p.name(color) else title = p.name(firstColor) .. '、' .. p.name(secondColor) end end local div = mw.html.create('div') div :attr('class', 'famed-color') :attr('title', title) :css('background', colorBackground) return tostring(div) end function p.colorbox(frame) args = getArgs(frame) return p._colorbox(args.color, args['First color'], args['Second color'], args['注释']) end return p