Module:SiteColor

From Paw Borough Wiki
Revision as of 10:57, 27 September 2023 by Imiya (talk | contribs) (Created page with "local p = {} function p.getSiteColor(theme) local switch = { ["Abyssal"] = "116, 87, 152", -- ["Sol"] = "131, 102, 77", -- ["Metropolis"] = "158, 38, 38", -- ["Luna"] = "179, 209, 243", -- ["Harvest"] = "126, 194, 89", -- ["Cogwheel"] = "235, 145, 52", -- ["Zenith"] = "249, 199, 67", -- } -- return the result, or use a default if unmatched. return switch[t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:SiteColor/doc

local p = {}

function p.getSiteColor(theme)
local switch = {
       ["Abyssal"]        = "116, 87, 152",   -- 
       ["Sol"]           = "131, 102, 77",   -- 
       ["Metropolis"] = "158, 38, 38",  -- 
       ["Luna"]     = "179, 209, 243",  -- 
       ["Harvest"]     = "126, 194, 89", -- 
       ["Cogwheel"]       = "235, 145, 52",   -- 
       ["Zenith"]     = "249, 199, 67",  -- 
   }
    
    -- 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