Module:Progression rainbow and Module:Progression rainbow/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
Override the default A-class color |
use require('strict') instead of require('Module:No globals') |
||
Line 109: | Line 109: | ||
if class.count ~= 0 then |
if class.count ~= 0 then |
||
local percentage = percent(class.count, total) |
local percentage = percent(class.count, total) |
||
-- The default Start-class color is difficult to distinguish next to |
|||
-- the Stub-class color, so we pick a midpoint between Stub and C |
|||
if class.class == 'Start' then |
|||
root:newline() -- sprinkled through to make the HTML easier to read |
|||
root:tag('li') |
|||
:css('background', '#ffca66') |
|||
:css('color','inherit') |
|||
:css('width', percentage) |
|||
:attr('title', string.format('%s %s', percentage, class.category)) |
|||
:tag('span') |
|||
:addClass('sr-only') |
|||
:wikitext(string.format('%s %s', percentage, class.category)) |
|||
:done() |
|||
:done() |
|||
-- The default A-class color is difficult to distinguish next to |
|||
-- the GA-class color, so we pick a midpoint between GA and FA |
|||
elseif class.class == 'A' then |
|||
root:newline() -- sprinkled through to make the HTML easier to read |
|||
root:tag('li') |
|||
:css('background', '#64e2ff') |
|||
:css('color','inherit') |
|||
:css('width', percentage) |
|||
:attr('title', string.format('%s %s', percentage, class.category)) |
|||
:tag('span') |
|||
:addClass('sr-only') |
|||
:wikitext(string.format('%s %s', percentage, class.category)) |
|||
:done() |
|||
:done() |
|||
else |
|||
root:newline() -- sprinkled through to make the HTML easier to read |
root:newline() -- sprinkled through to make the HTML easier to read |
||
root:tag('li') |
root:tag('li') |
||
Line 143: | Line 114: | ||
title = 'class/colour', args = { class.class } |
title = 'class/colour', args = { class.class } |
||
}) |
}) |
||
:css('color','inherit') |
|||
:css('width', percentage) |
:css('width', percentage) |
||
:attr('title', string.format('%s %s', percentage, class.category)) |
:attr('title', string.format('%s %s', percentage, class.category)) |
||
Line 151: | Line 121: | ||
:done() |
:done() |
||
:done() |
:done() |
||
end |
|||
end |
end |
||
end |
end |