@@ -13,6 +13,10 @@ local kMinLabelWidth = GuiUtilities.kCheckboxMinLabelWidth
1313local kMinMargin = GuiUtilities .kCheckboxMinMargin
1414local 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+
1620LabeledButtonClass = {}
1721LabeledButtonClass .__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
7888end
7989
117127
118128-- Too buggy with other GuiObjects to be used.
119129function 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
134140
135141function 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