Color

--

```
-- Used by [[Template:Keyword color]] and [[Template:Skin tier]]
local p = {}
local lib = require('Module:Feature')

local keywordcolor = {
    {"health",                 "#C03300"},
    {"hp",                     "#C03300"},
    {"attack damage",          "orange"},
    {"attack's damage",        "orange"},
    {"ad",                     "orange"},
    {"physical damage",        "#FF8C34"},
    {"pd",                     "#FF8C34"},
    {"ability power",          "lightgreen"},
    {"ap",                     "lightgreen"},
    {"magic damage",           "#00B0F0"},
    {"md",                     "#00B0F0"},
    {"true damage",            "#F9966B"}, -- used to dodge percent
    {"td",                     "#F9966B"},
    {"armor",                  "yellow"},
    {"armor penetration",      "tomato"},
    {"lethality",              "tomato"},
    {"magic resist",           "deeppink"},
    {"mr",                     "deeppink"},
    {"resist",                 "deeppink"},
    {"magic penetration",      "turquoise"},
    {"mana",                   "#0099CC"},
    {"energy",                 "yellow"},
    {"critical strike chance", "#E56013"},
    {"critical chance",        "#E56013"},
    {"critical strike damage", "#944B00"},
    {"critical damage",        "#944B00"},
    {"crit",                   "#944B00"},
    {"movement speed",         "#F5EE99"},
    {"ms",                     "#F5EE99"},
    {"xp",                     "#883FD1"},
    {"gold",                   "#FFD700"},
    {"siphoning strike",       "#5C58C9"},
    {"soul",                   "#5C58C9"},
    {"buzzword3",              "#E34D4C"},
    {"buzzword2",              "#56C456"},
    {"buzzword",               "#AF1AAF"},
    {"mist",                   "#26DFB0"},
    {"wild",                   "#A01D7A"},
    {"placed",                 "#883FD1"},
    {"attack speed",           "orangered"},
    {"as",                     "orangered"},
    {"fury",                   "#FA6533"},
    {"river",                  "#43D9FB"},
    {"terrain",                "#B36F21"},
    {"brush",                  "#96FB97"},
    {"life point",             "#56C456"},
    {"main",                   "#CA2697"},
    {"off%-hand",              "#E34D4C"},
    {"sweetspot",              "#E34D4C"},
    {"exalted",                "#FF7F00"},
    {"steel",                  "#748DD0"},
    {"azakana",                "#E2103F"}
}

local skincolor = {
    {"ultimate",               "#FFA500"}, -- orange
    {"3250",                   "#FFA500"}, -- orange
    {"2775",                   "#FFA500"}, -- orange
    {"legendary",              "#FF3232"},
    {"1820",                   "#FF3232"},
    {"loot",                   "#7943ED"},
    {"gem",                    "#7943ED"},
    {"mythic",                 "#7943ED"},
    {"2450",                   "#7943ED"},
    {"10",                     "#7943ED"},
    {"epic",                   "#00C8FF"},
    {"1350",                   "#00C8FF"},
    {"standard",               "#228B22"}, -- forestgreen
    {"superior",               "#228B22"}, -- forestgreen
    {"975",                    "#228B22"}, -- forestgreen
    {"budget",                 "#FFFFFF"}, -- white
    {"deluxe",                 "#FFFFFF"}, -- white
    {"750",                    "#FFFFFF"}, -- white
    {"classic",                "#808080"}, -- grey
    {"timeworn",               "#808080"}, -- grey
    {"520",                    "#808080"}, -- grey
    {"460",                    "#808080"}, -- grey
    {"390",                    "#808080"}, -- grey
    {"chroma",                 "#FFFFFF"}, -- white
    {"290",                    "#FFFFFF"}, -- white
    {"195",                    "#FFFFFF"}  -- white
}

function p.keyword(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

    for _, color in ipairs(keywordcolor) do
        result = mw.ustring.find(mw.ustring.lower(args[1]), color[1])
        if result ~= nil then
            return mw.text.nowiki(color[2])
        end
    end
    return "inherit"
end

function p.skin(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

    for _, color in ipairs(skincolor) do
        result = mw.ustring.find(mw.ustring.lower(args[1]), color[1])
        if result ~= nil then
            return mw.text.nowiki(color[2])
        end
    end
    return "inherit"
end

return p

--
```

--