Skip to content

Commit

Permalink
Power Bar color customization
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Feb 27, 2022
1 parent 906019e commit 4dac18f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ jobs:
if: '!contains( github.ref, ''beta'')'

- name: Create Pre-Release Package
run: curl -s https://raw.githubusercontent.com/BigWigsMods/packager/master/release.sh | bash -s -- -p 0 -w 0;
run: curl -s https://raw.githubusercontent.com/BigWigsMods/packager/master/release.sh | bash -s -- -p 0 -w 0 -a 0;
if: 'contains( github.ref, ''beta'')'
3 changes: 3 additions & 0 deletions Aptechka.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ local defaults = {
nameColorByClass = true,
useCustomBackgroundColor = false,
customBackgroundColor = {1,0,0},
powerColor = {0.5, 0.5, 1},
useCustomBackgroundColorPower = false,
customBackgroundColorPower = {0.5, 0.5, 1},
petColor = {1, 0.5, 0.5},
alphaOutOfRange = 0.45,

Expand Down
39 changes: 39 additions & 0 deletions Options/ProfileSettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,45 @@ function ns.MakeProfileSettings()
Aptechka:RefreshAllUnitsColors()
end,
},
powerColor = {
name = L"Power Color",
type = 'color',
width = 3,
order = 7.21,
get = function(info)
local r,g,b = unpack(Aptechka.db.profile.powerColor)
return r,g,b
end,
set = function(info, r, g, b)
Aptechka.db.profile.powerColor = {r,g,b}
Aptechka:RefreshAllUnitsColors()
end,
},
usePowerBGColor = {
name = L"Use Separate power Background Color",
type = "toggle",
width = 2,
get = function(info) return Aptechka.db.profile.useCustomBackgroundColorPower end,
set = function(info, v)
Aptechka.db.profile.useCustomBackgroundColorPower = not Aptechka.db.profile.useCustomBackgroundColorPower
Aptechka:RefreshAllUnitsColors()
end,
order = 7.22,
},
powerbgColor = {
name = L"Power BG Color",
type = 'color',
order = 7.23,
disabled = function() return not Aptechka.db.profile.useCustomBackgroundColorPower end,
get = function(info)
local r,g,b = unpack(Aptechka.db.profile.customBackgroundColorPower)
return r,g,b
end,
set = function(info, r, g, b)
Aptechka.db.profile.customBackgroundColorPower = {r,g,b}
Aptechka:RefreshAllUnitsColors()
end,
},
nameColorClassColor = {
name = L"Use Name Class Color",
type = "toggle",
Expand Down
26 changes: 25 additions & 1 deletion frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,30 @@ local SetJob_HealthBar = function(self, job, state, contentType, ...)
self.bg:SetColor(r2,g2,b2, bgAlpha,mulBG)
end
end
local SetJob_PowerBar = function(self, job, state, contentType, ...)
local profile = Aptechka.db.profile
local r,g,b,a
local r2,g2,b2
if contentType == "PowerBar" then
r,g,b = unpack(profile.powerColor)
if profile.useCustomBackgroundColorPower then
r2,g2,b2 = unpack(profile.customBackgroundColorPower)
else
r2,g2,b2 = r,g,b
end
else
local timerType, cur, max, count, icon, text, rC,gC,bC, texture, texCoords, isReversed = NormalizeContent(job, state, contentType, ...)
r,g,b,a = rC,gC,bC,1
r2,g2,b2 = r,g,b
end
if b then
local mulFG = profile.fgColorMultiplier or 1
local mulBG = profile.bgColorMultiplier or 0.2
local bgAlpha = profile.bgAlpha
self:SetColor(r,g,b,a,mulFG)
self.bg:SetColor(r2,g2,b2, bgAlpha,mulBG)
end
end

local PowerBar_OnPowerTypeChange = function(powerbar, powerType, isDead)
local self = powerbar:GetParent()
Expand Down Expand Up @@ -3064,7 +3088,7 @@ AptechkaDefaultConfig.GridSkin = function(self)
powerbar:SetMinMaxValues(0,100)
powerbar:SetOrientation("VERTICAL")
-- powerbar:SetStatusBarColor(0.5,0.5,1)
powerbar.SetJob = SetJob_HealthBar
powerbar.SetJob = SetJob_PowerBar
powerbar.OnPowerTypeChange = PowerBar_OnPowerTypeChange
powerbar.SetColor = HealthBarSetColorFG

Expand Down

0 comments on commit 4dac18f

Please sign in to comment.