Module:Sandbox/Jikat2/gradient

local p = {} p.gradient = function(frame) local ranking = frame.args.ranking local colorValue = "" local rankingPercent = ranking/43 local redNum = rankingPercent * 255 local greenNum = 102 + rankingPercent * 153 local redOut = string.format("%x", redNum) local greenOut = string.format("%x", greenNum) if string.len (redOut) == 1 then redOut = "0" .. redOut end if string.len (greenOut) == 1 then greenOut = "0" .. greenOut end colorValue = redOut .. greenOut .. "00" local msg = "" if redNum >= 50.0 then msg = "style='background:#" .. colorValue .. "; color:black'|" .. ranking end if redNum < 50.0 then msg = "style='background:#" .. colorValue .. "; color:white'|" .. ranking end return msg end return p