Module:Styles

From Ylvapedia
Revision as of 17:02, 22 September 2023 by Hachimitsu (talk | contribs) (Created page with "-- Library containing global coloring and styling used by multiple scripts -- dependencies local common = require("Module:Common") -- create global object local style = {} -- naming based on "Navbox" elements style.main_colors = { game = {border = '#A88580', title = '#FFC9C2', above = '#FFD1CA', group = '#FFD9D2', subgroup = '#FFE1DA', dark = '#FFEEE8', background = '#FFF4EE'}; music = {border = '#A8A077', title = '#FFF3B4', above = '#FFF6C0', group = '#FFF7C8', s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

-- Library containing global coloring and styling used by multiple scripts

-- dependencies
local common = require("Module:Common")

-- create global object
local style = {}

-- naming based on "Navbox" elements
style.main_colors = {
  game = {border = '#A88580', title = '#FFC9C2', above = '#FFD1CA', group = '#FFD9D2', subgroup = '#FFE1DA', dark = '#FFEEE8', background = '#FFF4EE'};
  music = {border = '#A8A077', title = '#FFF3B4', above = '#FFF6C0', group = '#FFF7C8', subgroup = '#FFF8D0', dark = '#FFFBE4', background = '#FFFBEE'};
  printwork = {border = '#9298A8', title = '#DDE6FF', above = '#E1E7FF', group = '#E6E9FF', subgroup = '#EAECFF', dark = '#EDF2FF', background = '#F4F9FF'};
}

-- function for easy adding of styles to html tags
function style.add(tbl, val)
  if common.isset(val) then
    local av = tostring(val):gsub("^%s*(.-)%s*$", "%1")
    if string.sub(av, -1) ~= ';' then av = av .. ';' end
    tbl[#tbl+1] = av
  end
end

return style