diff --git a/modules/config.lua b/modules/config.lua index 140fa606..926efe8c 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -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") diff --git a/modules/gui.lua b/modules/gui.lua index 8fc0d600..67c699ae 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -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") diff --git a/modules/pet.lua b/modules/pet.lua index bed4fbf4..ab1219ef 100644 --- a/modules/pet.lua +++ b/modules/pet.lua @@ -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) diff --git a/modules/player.lua b/modules/player.lua index c5706e9e..2367f75a 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -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 diff --git a/modules/target.lua b/modules/target.lua index e27df58d..bec49ad8 100644 --- a/modules/target.lua +++ b/modules/target.lua @@ -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 diff --git a/modules/targettarget.lua b/modules/targettarget.lua index c35b923f..6bf4e73f 100644 --- a/modules/targettarget.lua +++ b/modules/targettarget.lua @@ -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 diff --git a/modules/unitframes.lua b/modules/unitframes.lua index a70fa79e..0447ab6b 100644 --- a/modules/unitframes.lua +++ b/modules/unitframes.lua @@ -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