Module:Color

local p = {} function p.colors( f ) local args = f:getParent.args local colorCodes = mw.loadData( 'Module:Color/codes' ) local colorIds = mw.loadData( 'Module:Color/ids' ) local colorBlocks = {} local colorNames = {} local size = 20 local colorName = ''

--This slices one parameter into a variable number of parameters with a comma as a delimiter. --This allows the list to be called into another Template as its own parameter. local M_SLICES = {} for part in string.gmatch((args[1])..',', "([^,]*),") do	     table.insert(M_SLICES,part:match "^%s*(.-)%s*$") end

for i,color in ipairs(M_SLICES) do	colorName = color:gsub('%W',''):lower

colorId = 'No ID' if colorIds[colorName] ~= nil then colorId = colorIds[colorName] end

if colorCodes[colorName]~= nil then table.insert(colorBlocks,' ') end end return ' '..table.concat(colorBlocks)..' ' end return p