Module:SiteColor

From Inkipedia, the Splatoon wiki

Produces an RGB triplet color value using Inkipedia site colors.

Parameters

{{SiteColor|<theme>}}

theme Unnamed. The theme ID for the color to use. Must be one of the following:
  •   Generic
  •   Octo Expansion
  •   Salmon Run
  •   Side Order
  •   NIWA
  •   Splatoon
  •   Splatoon 2
  •   Splatoon 3
  •   Any other value, including unspecified

Example

Markup

<span style="color: rgb({{SiteColor|Splatoon 2}});">Sample text</span>

For use in templates with an optional color parameter:

style=" background:rgb({{#if:{{{color|}}}|{{{color}}}|{{SiteColor|Generic}}}}); " 

Output

Sample text


Class Example

You may also use Site Color's defined classes directly.

These are defined in MediaWiki:SiteColor.css. If this needs updating, please ask one of the interface administrators.


{| class="wikitable sitecolor-niwa"
! Column 1
! Column 2
|+
| Example || Value
|-
|}
Column 1 Column 2
Example Value
<div class="site-color-background-generic site-color-text-generic">Sample Generic Text</div>
<div class="site-color-background-shadow-niwa site-color-text-niwa">Sample NIWA Text</div>
<div class="site-color-background-shadow-s site-color-text-s">Sample S Text</div>
Sample Generic Text
Sample NIWA Text
Sample S Text

local p = {}

function p.getSiteColor(theme)
    local switch = {
        ["Generic"]        = "0, 153, 255",   -- <!-- #0099FF -->
        ["NIWA"]           = "229, 64, 52",   -- <!-- #E54034 -->
        ["Octo Expansion"] = "174, 21, 102",  -- <!-- #AE1566 -->
        ["Salmon Run"]     = "242, 124, 47",  -- <!-- #F27C2F -->
        ["Side Order"]     = "207, 133, 120", -- <!-- #CF8578 -->
        ["Splatoon"]       = "170, 220, 0",   -- <!-- #AADC00 -->
        ["Splatoon 2"]     = "240, 60, 120",  -- <!-- #F03C78 -->
        ["Splatoon 3"]     = "235, 238, 61",  -- <!-- #EBEE3D -->
    }
    
    -- return the result, or use a default if unmatched.
    return switch[theme] or "192, 192, 192" -- #C0C0C0
end

-- Main function that calls getTheme with a passed-in theme argument
function p.main(frame)
    -- The theme parameter is first positional, or nil if unspecified.
    local theme = frame:getParent().args[1]
    return p.getSiteColor(theme)
end

return p