local p =
colorsBroc =
function rounding(i) if i%1 >= 0.5 then return math.ceil(i) else return math.floor(i) endend
-- Main functionfunction p.main(frame) local args = require('Module:Arguments').getArgs(frame) local percent = (tonumber(args[1]) or -1)/100 if (percent < 0 or percent > 1) then return silver end local shade = 127 if (percent >= 0.1 and percent <= 0.9) then shade = rounding(((percent-0.1)/0.8) * 241 + 7) elseif (percent < 0.1) then shade = rounding(percent * 7) else shade = rounding((percent-0.9) * 7 + 248) end return ("#"..colorsBroc[255-shade]) or silverend
return p