Module:MCColor

From RetroMC
Revision as of 12:11, 19 February 2024 by Thecow275 (talk | contribs) (New module code possibly at some point, lets just see if this actually works first)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

text


local p = {}

-- Load the MCColor/data table
local data = mw.loadData('Module:MCColor/data')

function p.main(frame)
    local args = frame.args
    local mccolor = args[1]  -- Minecraft Color Code

    -- Check if the provided mccolor exists in the data table
    local MCColorData = data[mccolor]
    if not MCColorData then
        return ''  -- Return an empty string if the color is not found
    end

    -- Return the colorcode
    return MCColorData.wikicolor or ''
end

return p