FANDOM


-- <nowiki>
-- Implements {{Recolours}}
--
 
local p = {}
 
function p.main(frame)
    local args = frame:getParent().args
    local colourPrefix = 'colour'
    local namePrefix = 'name'
    local limit = tonumber(args.limit) or 16
    local tbl = mw.html.create('table')
            :addClass('recolour-table')
    local row
    local curArg
 
    for i=1, limit do
        curColour = args[colourPrefix .. tostring(i)] or '#fff'
        curName = args[namePrefix .. tostring(i)] or 'White'
 
        if i % 4 == 1 then
            if row then
                tbl = row:done()
                        :tag('tr')
                            :addClass('rec-empty-row')
                            :tag('td')
                                :addClass('rec-empty-cell')
                                :done()
                            :done()
            end
 
            row = tbl:tag('tr')
        end
 
        row:tag('td')
            :addClass('rec-cell')
            :css('background', curColour)
            :attr('title', curName)
            :done()
 
        if i % 4 ~= 0 then
            row:tag('td')
                :addClass('rec-empty-cell')
                :done()
        end
 
    end
 
    return tostring(tbl:allDone())
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.