(white space is lava) |
@DeletedUser41170185 (talk | contribs) No edit summary |
||
(29 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
+ | local colors = mw.loadData('Module:Color/data') |
||
− | |||
+ | local getArgs = require('Module:Arguments').getArgs |
||
− | color_dict = { |
||
− | -- GENERAL WIKI COLORS |
||
− | ["wiki1"] = "#B44335", |
||
− | ["wiki2"] = "#CD5F51", |
||
− | ["wiki3"] = "#FFAEA3", |
||
− | ["wiki4"] = "#FDE6E3", |
||
− | ["wiki5"] = "#E4C62E", |
||
− | ["wiki6"] = "#E38800", |
||
− | -- DOTA 2 UI |
||
− | ["ui1"] = "#1B1E21", |
||
− | ["ui2"] = "#2F363D", |
||
− | -- HEROES |
||
− | ["strength"] = "#B9500B", |
||
− | ["agility"] = "#167C13", |
||
− | ["intelligence"] = "#257DAE", |
||
− | ["radiant"] = "#598307", |
||
− | ["dire"] = "#A83806", |
||
− | ["neutral"] = "#434137", |
||
− | -- UNITS |
||
− | ["creep"] = "#2277AA", |
||
− | ["creep-hero"] = "#FFBE66", |
||
− | ["lane creep"] = "#2277AA", |
||
− | ["jungle creep"] = "#2277AA", |
||
− | ["ancient creep"] = "#2277AA", |
||
− | ["summon"] = "#FFBE66", |
||
− | ["ward"] = "#64D74A", |
||
− | ["building"] = "#2277AA", |
||
− | ["other"] = "pink", |
||
− | ["courier"] = "#FFBE66", |
||
− | -- ABILITIES |
||
− | ["hero"] = "#B44335", |
||
− | ["ultimate"] = "#414141", |
||
− | ["item"] = "#227722", |
||
− | ["npc"] = "#2277AA", |
||
− | ["aghanims"] = "#5B388F", |
||
− | ["talent"] = "#BDB76B", |
||
− | -- ITEMS |
||
− | ["gold"] = "#DAA520", |
||
− | ["armor"] = "#B911FC", |
||
− | ["caster"] = "#1A88FC", |
||
− | ["support"] = "#1A88FC", |
||
− | ["artifacts"] = "#DB9702", |
||
− | ["common"] = "#2BAC00", |
||
− | ["basic"] = "#FEFEFE", |
||
− | ["attributes"] = "#FEFEFE", |
||
− | ["armaments"] = "#FEFEFE", |
||
− | ["arcane"] = "#FEFEFE", |
||
− | -- COSMETIC ITEMS - RARITY |
||
− | ["cos_common"] = "#b0c3d9", |
||
− | ["cos_uncommon"] = "#5e98d9", |
||
− | ["cos_rare"] = "#4b69ff", |
||
− | ["cos_mythical"] = "#8847ff", |
||
− | ["cos_legendary"] = "#d32ce6", |
||
− | ["cos_ancient"] = "#eb4b4b", |
||
− | ["cos_immortal"] = "#b28a33", |
||
− | ["cos_arcana"] = "#ade55c", |
||
− | ["cos_seasonal"] = "#FFF34F", |
||
− | -- COSMETIC ITEMS - QUALITY |
||
− | ["cos_normal"] = "#B2B2B2", |
||
− | ["cos_genuine"] = "#4D7455", |
||
− | ["cos_elder"] = "#476291", -- Internal name: vintage |
||
− | ["cos_unusual"] = "#8650AC", |
||
− | ["cos_unique"] = "#D2D2D2", |
||
− | ["cos_community"] = "#70B04A", |
||
− | ["cos_developer"] = "#A50F79", |
||
− | ["cos_selfmade"] = "#70B04A", |
||
− | ["cos_customized"] = "#00FF00", |
||
− | ["cos_inscribed"] = "#CF6A32", -- Internal name: strange |
||
− | ["cos_completed"] = "#8650AC", |
||
− | ["cos_cursed"] = "#8650AC", |
||
− | ["cos_heroic"] = "#8650AC", -- Internal name: tournament |
||
− | ["cos_favored"] = "#FFFF00", |
||
− | ["cos_ascendant"] = "#EB4B4B", |
||
− | ["cos_autographed"] = "#ADE55C", |
||
− | ["cos_legacy"] = "#FFFFFF", |
||
− | ["cos_exalted"] = "#CCCCCC", |
||
− | ["cos_frozen"] = "#4682B4", |
||
− | ["cos_corrupted"] = "#A52A2A", |
||
− | ["cos_auspicious"] = "#32CD32", -- Internal name: lucky |
||
− | ["cos_unusual_text"] = "#e4ae39", |
||
− | -- RANKINGS |
||
− | ["proceed"] = "#CFC", |
||
− | ["up"] = "#CFC", |
||
− | ["stayup"] = "#EFA", |
||
− | ["stay"] = "#FF9", |
||
− | ["staydown"] = "#FDA", |
||
− | ["drop"] = "#FCC", |
||
− | ["down"] = "#FCC" |
||
− | } |
||
− | |||
⚫ | |||
− | local color_input = frame.args[1] |
||
− | local color_output = color_dict[color_input] |
||
− | if color_output == nil then |
||
− | color_output = color_input |
||
⚫ | |||
⚫ | |||
− | return color_output |
||
+ | local args = getArgs(frame, { |
||
+ | wrappers = { |
||
+ | 'Template:Color' |
||
+ | } |
||
+ | }) |
||
+ | |||
+ | local success, result = pcall(p._main, args) |
||
+ | if success then |
||
+ | return mw.text.nowiki(result) |
||
+ | else |
||
+ | -- Returning an empty string to prevent old templates from breaking. |
||
+ | -- TODO: Update all templates. |
||
+ | return '' |
||
⚫ | |||
end |
end |
||
+ | |||
− | |||
+ | function p._main(args) |
||
+ | assert(args[1], 'Missing input') |
||
+ | return colors[args[1]:lower()] or args[1] |
||
+ | end |
||
+ | |||
+ | |||
return p |
return p |
Latest revision as of 12:49, 20 April 2018
▶️
Planeshift.
The documentation for this module can be found at Template:Color.
You may be forwarded to another wiki language, in case a translation is not available.
Dependencies
local p = {}
local colors = mw.loadData('Module:Color/data')
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame, {
wrappers = {
'Template:Color'
}
})
local success, result = pcall(p._main, args)
if success then
return mw.text.nowiki(result)
else
-- Returning an empty string to prevent old templates from breaking.
-- TODO: Update all templates.
return ''
end
end
function p._main(args)
assert(args[1], 'Missing input')
return colors[args[1]:lower()] or args[1]
end
return p