api: trim down color gradient function

* avoid division through zero in unitframes
* make use of gradient func in unitframes
This commit is contained in:
shagu
2018-09-28 22:36:06 +02:00
parent aef2a61c6b
commit 2daddc2f43
3 changed files with 33 additions and 66 deletions
+1 -1
View File
@@ -357,7 +357,7 @@ pfUI:RegisterModule("panel", function()
repPercent = math.floor(lval / rval * 100)
if repPercent < 100 then
local link = GetInventoryItemLink("player",id)
local r,g,b,hex = GetColorGradient(repPercent/100, 1,0,0, 1,1,0, 0,1,0) -- red to green through yellow
local r,g,b,hex = GetColorGradient(repPercent/100)
local cPercent = string.format("%s%s%%|r",hex,repPercent)
widget.itemLines[table.getn(widget.itemLines)+1]={link, cPercent}
end