포켓몬 위키
가입하기
Advertisement

이 모듈에 대한 설명문서는 모듈:Color/설명문서에서 만들 수 있습니다

local color = {}
 
-- 색상표
-- ['타입'] = { '밝은색', '표준색', '진한색' } 순서로 표기
local scheme = {
    ['노말'] = { '#a8a878', '#c6c6a7', '#6d6d4e' },
    ['불꽃'] = { '#f08030', '#f5ac78', '#9c531f' },
    ['물'] = { '#6890f0', '#9db7f5', '#445e9c' },
    ['전기'] = { '#f8d030', '#fae078', '#a1871f' },
    ['풀'] = { '#78c850', '#a7db8d', '#4e8234' },
    ['얼음'] = { '#98d8d8', '#bce6e6', '#638d8d' },
    ['격투'] = { '#c03028', '#d67873', '#7d1f1a' },
    ['독'] = { '#a040a0', '#c183c1', '#682a68' },
    ['땅'] = { '#e0c068', '#ebd69d', '#927d44' },
    ['비행'] = { '#a890f0', '#c6b7f5', '#6d5e9c' },
    ['에스퍼'] = { '#f85888', '#fa92b2', '#a13959' },
    ['벌레'] = { '#a8b820', '#c6d16e', '#6d7815' },
    ['바위'] = { '#b8a038', '#d1c17d', '#786824' },
    ['고스트'] = { '#705898', '#a292bc', '#493963' },
    ['드래곤'] = { '#7038f8', '#a27dfa', '#4924a1' },
    ['악'] = { '#705848', '#a29288', '#49392f' },
    ['강철'] = { '#b8b8d0', '#d1d1e0', '#787887' },
    ['페어리'] = { '#fea3e8', '#ffcff3', '#b66783' },
    ['???'] = { '#68a090', '#9dc1b7', '#44685e' }
}
 
-- 틀:색
function color.toText ( frame )
    local args = frame.args
    local output = mw.html.create( 'span' )
 
    local sColor = args[1] ~= 'inherit' and '#' .. args[1] or 'inherit'
    local sText = args[2] ~= '' and args[2] or '내용을 입력해 주세요.'
 
    output
        :css( 'color', sColor )
        :wikitext( sText )
        :done()
 
    return output
end
 
-- 틀:색2
function color.toLink ( frame )
    local args = frame.args
    local sColor = args[1] ~= 'initial' and '#' .. args[1] or 'initial'
    local sText = args[2]
    local sTextAlt
    if not args[3] then
        sTextAlt = sText
    elseif args[3] ~= '' then
        sTextAlt = sText
    else
        sTextAlt = args[3]
    end
 
    return '[[' .. sText .. '|<span style="color:' .. sColor ..'">' .. sTextAlt .. '</span>]]'
end
 
-- 틀:색타
function color.toTypeLink ( frame )
    local args = frame.args
    local sColor = args[1]
    local sTextColor = args[2]
    local output = mw.html.create( 'span' )
 
    output
        :css( 'background', scheme[sColor][2] )
        :css( 'padding', '0 .5em' )
        :wikitext( '[[' .. sColor .. ' (타입)|<span style="color:#' .. sTextColor ..'">' .. sColor .. '</span>]]' )
        :done()
 
    return output
end
 
return color
Advertisement