FANDOM


local infobox = {}
 
local getArgs = require( 'Module:Arguments' ).getArgs
local scheme = mw.loadData( 'Module:Color/Scheme' ) -- 전체 색상표
local typeScheme = scheme.types -- 타입 색상표
 
local function switcherItems( text, bgColor, borderColor )
    return '<tr><td class="font-weight-bold" style="background: ' .. bgColor .. '; border: 2px solid ' .. borderColor .. '; border-radius: 10px;">[[#|<span style="color: #111">' .. text .. '</span>]]</td></tr>'
end
 
function infobox.switcher( frame )
    local args = getArgs( frame )
 
    if args[1] == nil then return '' end
 
    local type1, type2 = args['타입1'], args['타입2']
    local color1, color2 = typeScheme['표']
    local title = args['제목'] or ''
    local items = {}
 
    if type1 ~= nil and typeScheme[type1] then color1, color2 = typeScheme[type1] end
    if type2 ~= nil and typeScheme[type2] then color2 = typeScheme[type2] end
 
    for key, value in ipairs( args ) do
        if type( key ) == 'number' then
            table.insert( items, switcherItems( value, color1[1], color2[2] ) )
        end
    end
 
    local ret = '<table id="pokemonToggle" class="float-right mb-1 ml-1 text-center rounded" style="background: ' .. color1[2] .. '; border: 4px solid ' .. color1[3] .. '; border-spacing: 4px;"><tr><th>' .. title  .. '</th></tr>' .. table.concat( items ) .. '</table>'
 
    return ret
end
 
return infobox
Community content is available under CC-BY-SA unless otherwise noted.