Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit 7bc67b8

Browse files
committed
Updated colors.
1 parent 9c37b6c commit 7bc67b8

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/Workspace/SignsInternal/StudioWidgets/LabeledButton.lua

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ local kMinLabelWidth = GuiUtilities.kCheckboxMinLabelWidth
1313
local kMinMargin = GuiUtilities.kCheckboxMinMargin
1414
local kMinButtonWidth = kCheckboxWidth;
1515

16+
local kButtonDefaultBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.FilterButtonDefault, Enum.StudioStyleGuideModifier.Default)
17+
local kButtonHoverBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.FilterButtonHover, Enum.StudioStyleGuideModifier.Hover)
18+
local kButtonPressedBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.FilterButtonChecked, Enum.StudioStyleGuideModifier.Pressed)
19+
1620
LabeledButtonClass = {}
1721
LabeledButtonClass.__index = LabeledButtonClass
1822

@@ -33,7 +37,7 @@ function LabeledButtonClass.new(nameSuffix, labelText, initValue, initDisabled)
3337
fullBackgroundButton.Parent = frame
3438
fullBackgroundButton.BorderSizePixel = 0
3539
fullBackgroundButton.BackgroundTransparency = 0
36-
fullBackgroundButton.Size = UDim2.new(0, GuiUtilities.DefaultLineLabelWidth, 1, 0)
40+
fullBackgroundButton.Size = UDim2.new(1, 0, 1, 0)
3741
fullBackgroundButton.Position = UDim2.new(0, 0, 0, 0)
3842
fullBackgroundButton.Text = ""
3943
fullBackgroundButton.AutoButtonColor = false
@@ -74,6 +78,12 @@ function LabeledButtonClass.new(nameSuffix, labelText, initValue, initDisabled)
7478
settings().Studio.ThemeChanged:Connect(updateFontColors)
7579
updateFontColors()
7680

81+
local function updateButtonColors()
82+
self:_updateCheckboxVisual()
83+
end
84+
settings().Studio.ThemeChanged:Connect(updateButtonColors)
85+
updateButtonColors()
86+
7787
return self
7888
end
7989

@@ -117,10 +127,6 @@ end
117127

118128
-- Too buggy with other GuiObjects to be used.
119129
function LabeledButtonClass:_updateCheckboxVisual()
120-
local kButtonDefaultBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Default)
121-
local kButtonHoverBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Hover)
122-
local kButtonPressedBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Pressed)
123-
124130
if (self._value) then
125131
self._button.BackgroundColor3 = kButtonPressedBackgroundColor
126132
elseif (self._clicked) then
@@ -134,11 +140,9 @@ end
134140

135141
function LabeledButtonClass:_HandleUpdatedValue()
136142
if (self:GetValue())then
137-
kButtonBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Pressed)
138-
self._button.BackgroundColor3 = kButtonBackgroundColor
143+
self._button.BackgroundColor3 = kButtonPressedBackgroundColor
139144
else
140-
kButtonBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Default)
141-
self._button.BackgroundColor3 = kButtonBackgroundColor
145+
self._button.BackgroundColor3 = kButtonDefaultBackgroundColor
142146
end
143147

144148
if (self._valueChangedFunction) then

0 commit comments

Comments
 (0)