Skip to content

Commit

Permalink
Add status bar transparency and detach it from artwork's setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wutname1 committed Jun 16, 2023
1 parent ab3d7b3 commit 8646d13
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 32 deletions.
1 change: 1 addition & 0 deletions Core/Framework.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ local DBdefault = {
StatusBars = {
['**'] = {
size = { 256, 36 },
alpha = 1,
bgTooltip = 'Interface\\Addons\\SpartanUI\\Images\\status-tooltip',
texCordsTooltip = { 0.103515625, 0.8984375, 0.1796875, 0.8203125 },
TooltipSize = { 300, 100 },
Expand Down
82 changes: 50 additions & 32 deletions Modules/Artwork/StatusBars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function module:factory()
local StyleSetting = SUI.DB.Styles[SUI.DB.Artwork.Style].StatusBars[key]

--Status Bar
local statusbar = CreateFrame('Frame', 'SUI_StatusBar_' .. key, _G['SUI_Art_' .. SUI.DB.Artwork.Style])
local statusbar = CreateFrame('Frame', 'SUI_StatusBar_' .. key, SpartanUI)
statusbar:SetSize(unpack(StyleSetting.size))
statusbar:SetFrameStrata('BACKGROUND')

Expand Down Expand Up @@ -337,6 +337,7 @@ function module:factory()
local point, anchor, secondaryPoint, x, y = strsplit(',', StyleSetting.Position)
statusbar:ClearAllPoints()
statusbar:SetPoint(point, anchor, secondaryPoint, x, y)
statusbar:SetAlpha(module.DB[i].alpha or 1)

--Setup Actions
statusbar:RegisterEvent('PLAYER_ENTERING_WORLD')
Expand Down Expand Up @@ -402,6 +403,7 @@ function module:factory()
else
module.bars[key]:Hide()
end
module.bars[key]:SetAlpha(module.DB[i].alpha or 1)
end
end)
end
Expand Down Expand Up @@ -485,45 +487,61 @@ function module:BuildOptions()
SUI:SendMessage('StatusBarUpdate')
end,
},
CustomColor1 = {
name = L['Primary custom color'],
type = 'color',
hasAlpha = true,
order = 4,
colors = {
name = 'name',
type = 'group',
inline = true,
get = function(info)
local colors = module.DB[i].CustomColor
return colors.r, colors.g, colors.b, colors.a
return module.DB[i][info[#info]]
end,
set = function(info, r, g, b, a)
local colors = module.DB[i].CustomColor
colors.r, colors.g, colors.b, colors.a = r, g, b, a
SUI:SendMessage('StatusBarUpdate')
end,
},
CustomColor2 = {
name = L['Secondary custom color'],
type = 'color',
hasAlpha = true,
order = 4,
get = function(info)
local colors = module.DB[i].CustomColor2
return colors.r, colors.g, colors.b, colors.a
end,
set = function(info, r, g, b, a)
local colors = module.DB[i].CustomColor2
colors.r, colors.g, colors.b, colors.a = r, g, b, a
set = function(info, val)
module.DB[i][info[#info]] = val
SUI:SendMessage('StatusBarUpdate')
end,
args = {
CustomColor = {
name = L['Primary custom color'],
type = 'color',
hasAlpha = true,
order = 4,
get = function(info)
local colors = module.DB[i].CustomColor
return colors.r, colors.g, colors.b, colors.a
end,
set = function(info, r, g, b, a)
local colors = module.DB[i].CustomColor
colors.r, colors.g, colors.b, colors.a = r, g, b, a
SUI:SendMessage('StatusBarUpdate')
end,
},
CustomColor2 = {
name = L['Secondary custom color'],
type = 'color',
hasAlpha = true,
order = 4,
get = function(info)
local colors = module.DB[i].CustomColor2
return colors.r, colors.g, colors.b, colors.a
end,
set = function(info, r, g, b, a)
local colors = module.DB[i].CustomColor2
colors.r, colors.g, colors.b, colors.a = r, g, b, a
SUI:SendMessage('StatusBarUpdate')
end,
},
},
},
AutoColor = {
name = L['Auto color'],
type = 'toggle',
order = 5,
alpha = {
name = 'Transparency',
type = 'range',
min = 0,
max = 1,
step = 0.01,
get = function(info)
return module.DB[i].AutoColor
return module.DB[i].alpha
end,
set = function(info, val)
module.DB[i].AutoColor = val
module.DB[i].alpha = val
SUI:SendMessage('StatusBarUpdate')
end,
},
Expand Down

0 comments on commit 8646d13

Please sign in to comment.