uf: add option for dark and non-pastel colors

This commit is contained in:
shagu
2016-12-02 19:51:00 +01:00
parent 48375a402a
commit 9614443ea7
8 changed files with 108 additions and 20 deletions
+2
View File
@@ -22,6 +22,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("appearance", "cd", "daycolor", "5555ff")
pfUI:UpdateConfig("appearance", "cd", "threshold", "2")
pfUI:UpdateConfig("unitframes", nil, "disable", "0")
pfUI:UpdateConfig("unitframes", nil, "pastel", "1")
pfUI:UpdateConfig("unitframes", nil, "dark", "0")
pfUI:UpdateConfig("unitframes", nil, "animation_speed", "5")
pfUI:UpdateConfig("unitframes", nil, "portrait", "1")
pfUI:UpdateConfig("unitframes", nil, "buff_size", "20")
+19 -5
View File
@@ -211,11 +211,25 @@ pfUI:RegisterModule("group", function ()
end
_, class = UnitClass("party"..this.id)
local c = RAID_CLASS_COLORS[class]
local cr, cg, cb = 0, 0, 0
if c then cr, cg, cb =(c.r + .5) * .5, (c.g + .5) * .5, (c.b + .5) * .5 end
this.hp.bar:SetStatusBarColor(cr, cg, cb)
local color = RAID_CLASS_COLORS[class]
local r, g, b = .2, .2, .2
if pfUI_config.unitframes.dark == "1" and color then
this.hp.bar:SetStatusBarColor(r, g, b)
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
this.caption:SetTextColor(r,g,b)
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
this.hp.bar:SetStatusBarColor(r, g, b)
this.caption:SetTextColor(1,1,1)
end
local pcolor = ManaBarColor[UnitPowerType("party"..this.id)]
this.power.bar:SetStatusBarColor(pcolor.r + .5, pcolor.g +.5, pcolor.b +.5, 1)
+2
View File
@@ -636,6 +636,8 @@ pfUI:RegisterModule("gui", function ()
-- unitframes
pfUI.gui.uf = pfUI.gui:CreateConfigTab("UnitFrames")
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, "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")
+19 -3
View File
@@ -62,6 +62,7 @@ pfUI:RegisterModule("pet", function ()
local power, powermax = UnitMana("pet"), UnitManaMax("pet")
local happiness = GetPetHappiness()
local color = .2, .2, .2
if happiness == 1 then
color = { r = 1, g = 0, b = 0 }
elseif happiness == 2 then
@@ -69,11 +70,26 @@ pfUI:RegisterModule("pet", function ()
else
color = { r = 0, g = 1, b = 0 }
end
local r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
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
pfUI.uf.pet.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
end
pfUI.uf.pet.hp.text:SetTextColor(r, g, b)
pfUI.uf.pet.hp.bar:SetMinMaxValues(0, hpmax)
pfUI.uf.pet.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
pfUI.uf.pet.hp.text:SetTextColor(r+.3,g+.3,b+.3, 1)
pfUI.uf.pet.hp.text:SetText(UnitName("pet"))
pfUI.uf.pet.hpReal = hp
+9 -1
View File
@@ -124,7 +124,15 @@ pfUI:RegisterModule("player", function ()
_, class = UnitClass("player")
local color = RAID_CLASS_COLORS[class]
local cr, cg, cb = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
local cr, cg, cb
if pfUI_config.unitframes.dark == "1" then
cr, cg, cb = .2,.2,.2
elseif pfUI_config.unitframes.pastel == "1" then
cr, cg, cb = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
else
cr, cg, cb = color.r, color.g, color.b
end
local perc = hp / hpmax
pfUI.uf.player.hp.bar:SetMinMaxValues(0, hpmax)
+22 -5
View File
@@ -260,10 +260,25 @@ pfUI:RegisterModule("raid", function ()
end
_, class = UnitClass("raid"..unit.id)
local c = RAID_CLASS_COLORS[class]
local cr, cg, cb = 0, 0, 0
if c then cr, cg, cb =(c.r + .5) * .5, (c.g + .5) * .5, (c.b + .5) * .5 end
unit.hp.bar:SetStatusBarColor(cr, cg, cb)
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.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
unit.hp.bar:SetStatusBarColor(r, g, b)
end
unit.caption:SetTextColor(r,g,b)
local p = ManaBarColor[UnitPowerType("raid"..unit.id)]
local pr, pg, pb = 0, 0, 0
@@ -276,7 +291,9 @@ pfUI:RegisterModule("raid", function ()
unit.caption:SetTextColor(1,.3,.3)
else
unit.caption:SetText(UnitName("raid"..unit.id))
unit.caption:SetTextColor(1,1,1)
if pfUI_config.unitframes.dark ~= "1" then
unit.caption:SetTextColor(1,1,1)
end
end
unit.caption:SetAllPoints(unit.hp.bar)
end
+17 -3
View File
@@ -113,11 +113,25 @@ pfUI:RegisterModule("target", function ()
color = UnitReactionColor[UnitReaction("target", "player")]
end
local r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
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.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
else
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
pfUI.uf.target.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
end
pfUI.uf.target.powerText:SetTextColor(r, g, b, 1)
pfUI.uf.target.hp.bar:SetMinMaxValues(0, hpmax)
pfUI.uf.target.hp.bar:SetStatusBarColor(r, g, b, hp / hpmax / 4 + .75)
pfUI.uf.target.powerText:SetTextColor(r, g, b, 1)
local perc = hp / hpmax
local r1, g1, b1, r2, g2, b2
+18 -3
View File
@@ -58,9 +58,24 @@ pfUI:RegisterModule("targettarget", function ()
pfUI.uf.targettarget.hp.bar:SetMinMaxValues(0, UnitHealthMax("targettarget"))
if color then
local r, g, b = (color.r + .5) * .5, (color.g + .5) * .5, (color.b + .5) * .5
pfUI.uf.targettarget.hp.bar:SetStatusBarColor(r, g, b, UnitHealth("targettarget") / UnitHealthMax("targettarget") / 4 + .75)
pfUI.uf.targettarget.hp.text:SetTextColor(r+.3,g+.3,b+.3, 1)
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.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
else
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
pfUI.uf.targettarget.hp.bar:SetStatusBarColor(r, g, b, UnitHealth("targettarget") / UnitHealthMax("targettarget") / 4 + .75)
end
pfUI.uf.targettarget.hp.text:SetTextColor(r, g, b, 1)
end
pfUI.uf.targettarget.hp.text:SetText( UnitName("targettarget"))