Module:SiteColor

From Paw Borough Wiki
Revision as of 08:37, 27 September 2023 by Imiya (talk | contribs) (Created page with "local p = {} function p.getSiteColor(theme) local switch = { ["Abyssal"] = "116, 87, 152", -- <!-- #745798--> ["Sol"] = "131, 102, 77", -- <!-- #83664d--> ["Metropolis"] = "158, 38, 38", -- <!-- #9e2626--> ["Luna"] = "179, 209, 243", -- <!-- #b3d1f3--> ["Harvest"] = "126, 194, 89", -- <!-- #7ec259--> ["Cogwheel"] = "235, 145, 52", -- <!-- #eb9134--> ["Zenith"] = "249,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 "150, 92, 45" -- #965C2D

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