api: add fallback color to gradients

This commit is contained in:
shagu
2018-09-30 18:00:16 +02:00
parent 4d508925f9
commit 3ce4e98862
+2 -1
View File
@@ -852,7 +852,8 @@ end
-- return r,g,b and hexcolor
local gradientcolors = {}
function pfUI.api.GetColorGradient(perc)
if perc < 0 or perc > 1 then return nil,nil,nil,nil end
-- fallback to black on bad numbers
if perc < 0 or perc > 1 then return 0,0,0,"|cff000000" end
if not gradientcolors[perc] then
local r1, g1, b1, r2, g2, b2