unitframes: add custom healthbar colors

This commit is contained in:
shagu
2016-12-27 14:21:36 +01:00
parent d858d308bb
commit 40789119bd
7 changed files with 32 additions and 26 deletions
+2 -1
View File
@@ -38,7 +38,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "disable", "0")
pfUI:UpdateConfig("unitframes", nil, "pastel", "1")
pfUI:UpdateConfig("unitframes", nil, "dark", "0")
pfUI:UpdateConfig("unitframes", nil, "custom", "0")
pfUI:UpdateConfig("unitframes", nil, "customcolor", ".2,.2,.2,1")
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
pfUI:UpdateConfig("unitframes", nil, "portrait", "1")
pfUI:UpdateConfig("unitframes", nil, "buff_size", "20")
+2 -1
View File
@@ -829,7 +829,8 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Settings", nil, nil, "header")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Disable pfUI-UnitFrames", pfUI_config.unitframes, "disable", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Use pastel colors", pfUI_config.unitframes, "pastel", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Use dark shades for healthbars", pfUI_config.unitframes, "dark", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Use custom color for healthbars", pfUI_config.unitframes, "custom", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Custom healthbar color", pfUI_config.unitframes, "customcolor", "color")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Animation speed", pfUI_config.unitframes, "animation_speed")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show portrait", pfUI_config.unitframes, "portrait", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff size", pfUI_config.unitframes, "buff_size")
+10 -13
View File
@@ -91,19 +91,16 @@ pfUI:RegisterModule("pet", function ()
end
local r, g, b = .2, .2, .2
if pfUI_config.unitframes.dark == "1" and color then
pfUI.uf.pet.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
if pfUI_config.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
r, g, b = color.r, color.g, color.b
end
elseif color then
if pfUI_config.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
r, g, b = color.r, color.g, color.b
end
if pfUI_config.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
r, g, b = color.r, color.g, color.b
end
if pfUI_config.unitframes.custom == "1" then
local cr, cg, cb, ca = pfUI.api.strsplit(",", pfUI_config.unitframes.customcolor)
pfUI.uf.pet.hp.bar:SetStatusBarColor(tonumber(cr), tonumber(cg), tonumber(cb), hp / hpmax / 4 + .75)
else
pfUI.uf.pet.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
end
pfUI.uf.pet.hp.text:SetTextColor(r, g, b)
+3 -2
View File
@@ -177,8 +177,9 @@ pfUI:RegisterModule("player", function ()
local color = RAID_CLASS_COLORS[class]
local cr, cg, cb
if pfUI_config.unitframes.dark == "1" then
cr, cg, cb = .2,.2,.2
if pfUI_config.unitframes.custom == "1" then
local r, g, b, a = pfUI.api.strsplit(",", pfUI_config.unitframes.customcolor)
cr, cg, cb = tonumber(r), tonumber(g), tonumber(b)
elseif pfUI_config.unitframes.pastel == "1" then
cr, cg, cb = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
+5 -2
View File
@@ -158,8 +158,11 @@ pfUI:RegisterModule("target", function ()
end
local r, g, b = .2, .2, .2
if pfUI_config.unitframes.dark == "1" then
pfUI.uf.target.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
if pfUI_config.unitframes.custom == "1" then
local cr, cg, cb, ca = pfUI.api.strsplit(",", pfUI_config.unitframes.customcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.target.hp.bar:SetStatusBarColor(cr, cg, cb, hp / hpmax / 4 + .75)
if pfUI_config.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
+5 -4
View File
@@ -106,11 +106,12 @@ pfUI:RegisterModule("targettarget", function ()
end
pfUI.uf.targettarget.hp.bar:SetMinMaxValues(0, UnitHealthMax("targettarget"))
local r, g, b = .2, .2, .2
if color then
local r, g, b = .2, .2, .2
if pfUI_config.unitframes.dark == "1" then
pfUI.uf.targettarget.hp.bar:SetStatusBarColor(r, g, b, UnitHealth("targettarget") / UnitHealthMax("targettarget") / 4 + .75)
if pfUI_config.unitframes.custom == "1" then
local cr, cg, cb, ca = pfUI.api.strsplit(",", pfUI_config.unitframes.customcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
pfUI.uf.targettarget.hp.bar:SetStatusBarColor(cr, cg, cb, UnitHealth("targettarget") / UnitHealthMax("targettarget") / 4 + .75)
if pfUI_config.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
+5 -3
View File
@@ -263,8 +263,10 @@ function pfUI.uf:RefreshUnit(unit)
local color = RAID_CLASS_COLORS[class]
local r, g, b = .2, .2, .2
if pfUI_config.unitframes.dark == "1" and color then
unit.hp.bar:SetStatusBarColor(r, g, b)
if pfUI_config.unitframes.custom == "1" and color then
local cr, cg, cb, ca = pfUI.api.strsplit(",", pfUI_config.unitframes.customcolor)
cr, cg, cb = tonumber(cr), tonumber(cg), tonumber(cb)
unit.hp.bar:SetStatusBarColor(cr, cg, cb)
if pfUI_config.unitframes.pastel == "1" then
r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
@@ -291,7 +293,7 @@ function pfUI.uf:RefreshUnit(unit)
unit.caption:SetTextColor(1,.3,.3)
else
unit.caption:SetText(UnitName(unit.label..unit.id))
if pfUI_config.unitframes.dark ~= "1" then
if pfUI_config.unitframes.custom ~= "1" then
unit.caption:SetTextColor(1,1,1)
end
end