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

Commit 64b15c4

Browse files
committed
Dark theme support.
1 parent 31295d4 commit 64b15c4

File tree

5 files changed

+57
-34
lines changed

5 files changed

+57
-34
lines changed

src/Workspace/SignsInternal/StudioWidgets/CollapsibleTitledSection.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ function CollapsibleTitledSectionClass:_CreateTitleBar(titleText)
117117

118118
local titleBar = Instance.new('ImageButton')
119119
if self._minimizable == true then
120-
titleBar.AutoButtonColor = true -- TODO: Set this to false when you implement a better solution.
120+
titleBar.AutoButtonColor = true -- TODO: Set this to false when you implement a better solution.
121121
else
122-
titleBar.AutoButtonColor = false -- TODO: Set this to false when you implement a better solution.
122+
titleBar.AutoButtonColor = false -- TODO: Set this to false when you implement a better solution.
123123
end
124124
titleBar.Name = 'TitleBarVisual'
125125
titleBar.BorderSizePixel = 0
@@ -132,8 +132,8 @@ function CollapsibleTitledSectionClass:_CreateTitleBar(titleText)
132132
local titleLabel = Instance.new('TextLabel')
133133
titleLabel.Name = 'TitleLabel'
134134
titleLabel.BackgroundTransparency = 1
135-
titleLabel.Font = Enum.Font.SourceSansBold --todo: input spec font
136-
titleLabel.TextSize = 15 --todo: input spec font size
135+
titleLabel.Font = Enum.Font.SourceSansBold -- TODO: input spec font
136+
titleLabel.TextSize = 15 -- TODO: input spec font size
137137
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
138138
titleLabel.Text = titleText
139139
titleLabel.Position = UDim2.new(0, titleTextOffset, 0, 0)
@@ -143,7 +143,7 @@ function CollapsibleTitledSectionClass:_CreateTitleBar(titleText)
143143

144144
self._minimizeButton = Instance.new('ImageButton')
145145
self._minimizeButton.Name = 'MinimizeSectionButton'
146-
self._minimizeButton.Image = kRightButtonAsset --todo: input arrow image from spec
146+
self._minimizeButton.Image = kRightButtonAsset -- TODO: input arrow image from spec
147147
self._minimizeButton.Size = UDim2.new(0, kArrowSize, 0, kArrowSize)
148148
self._minimizeButton.AnchorPoint = Vector2.new(0.5, 0.5)
149149
self._minimizeButton.Position = UDim2.new(0, self._titleBarHeight*.5,

src/Workspace/SignsInternal/StudioWidgets/CustomTextButton.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function CustomTextButtonClass.new(buttonName, labelText)
6565
self._clicked = false
6666
self:_updateButtonVisual()
6767
end
68-
end)
68+
end)
6969

7070
button.MouseButton1Down:Connect(function()
7171
self._clicked = true
@@ -77,7 +77,6 @@ function CustomTextButtonClass.new(buttonName, labelText)
7777
self:_updateButtonVisual()
7878
end)
7979

80-
settings().Studio.ThemeChanged:Connect(self:_updateButtonVisual())
8180
self:_updateButtonVisual()
8281

8382
return self

src/Workspace/SignsInternal/StudioWidgets/GuiUtilities.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module.kInlineTitleBarHeight = 24
55

66
module.kStandardContentAreaWidth = 180
77

8+
module.kStandardFontSize = 15
9+
810
module.kStandardPropertyHeight = 30
911
module.kSubSectionLabelHeight = 30
1012

@@ -218,8 +220,8 @@ function module.MakeStandardPropertyLabel(text, opt_ignoreThemeUpdates)
218220
label.RichText = true
219221
label.Name = 'Label'
220222
label.BackgroundTransparency = 1
221-
label.Font = Enum.Font.SourceSans --todo: input spec font
222-
label.TextSize = 15 --todo: input spec font size
223+
label.Font = Enum.Font.SourceSans -- TODO: input spec font
224+
label.TextSize = 15 -- TODO: input spec font size
223225
label.TextXAlignment = Enum.TextXAlignment.Left
224226
label.Text = text
225227
label.AnchorPoint = Vector2.new(0, 0.5)

src/Workspace/SignsInternal/StudioWidgets/LabeledCheckbox.lua

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ local kDisabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_ind
3434
local kHoverCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_light.png"
3535
local kCheckboxFrameImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_light.png"
3636

37+
local kEnabledCheckImageDark = "rbxasset://textures/DeveloperFramework/checkbox_checked_dark.png"
38+
local kDisabledCheckImageDark = "rbxasset://textures/DeveloperFramework/checkbox_indeterminate_dark.png"
39+
local kHoverCheckImageDark = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_dark.png"
40+
local kCheckboxFrameImageDark = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_dark.png"
41+
3742
LabeledCheckboxClass = {}
3843
LabeledCheckboxClass.__index = LabeledCheckboxClass
3944

@@ -101,20 +106,10 @@ function LabeledCheckboxClass.new(nameSuffix, labelText, initValue, initDisabled
101106
self:_SetupMouseClickHandling()
102107

103108
local function updateImages()
104-
if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
105-
if self._button.Image == kCheckboxFrameImage then
106-
kEnabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_checked_dark.png"
107-
kDisabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_indeterminate_dark.png"
108-
kHoverCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_dark.png"
109-
kCheckboxFrameImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_dark.png"
110-
end
111-
self:_updateCheckboxVisual()
109+
if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
110+
self._button.Image = kCheckboxFrameImageDark
112111
else
113-
kEnabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_checked_light.png"
114-
kDisabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_indeterminate_light.png"
115-
kHoverCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_light.png"
116-
kCheckboxFrameImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_light.png"
117-
self:_updateCheckboxVisual()
112+
self._button.Image = kCheckboxFrameImage
118113
end
119114
end
120115
settings().Studio.ThemeChanged:Connect(updateImages)
@@ -163,14 +158,15 @@ function LabeledCheckboxClass:_SetupMouseClickHandling()
163158
end)
164159
end
165160

161+
-- Too buggy with other GuiObjects to be used.
166162
function LabeledCheckboxClass:_updateCheckboxVisual()
167-
if (self._clicked) then
168-
self._button.Image = kCheckboxFrameImage
169-
elseif (self._hovered) then
170-
self._button.Image = kHoverCheckImage
171-
else
172-
self._button.Image = kCheckboxFrameImage
173-
end
163+
-- if (self._clicked) then
164+
-- self._button.Image = kCheckboxFrameImage
165+
-- elseif (self._hovered) then
166+
-- self._button.Image = kHoverCheckImage
167+
-- else
168+
-- self._button.Image = kCheckboxFrameImage
169+
-- end
174170
end
175171

176172
function LabeledCheckboxClass:_HandleUpdatedValue()
@@ -241,9 +237,17 @@ function LabeledCheckboxClass:SetDisabled(newDisabled)
241237
end
242238

243239
if (newDisabled) then
244-
self._checkImage.Image = kDisabledCheckImage
240+
if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
241+
self._checkImage.Image = kDisabledCheckImageDark
242+
else
243+
self._checkImage.Image = kDisabledCheckImage
244+
end
245245
else
246-
self._checkImage.Image = kEnabledCheckImage
246+
if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
247+
self._checkImage.Image = kEnabledCheckImageDark
248+
else
249+
self._checkImage.Image = kEnabledCheckImage
250+
end
247251
end
248252

249253
self:UpdateFontColors()

src/Workspace/SignsInternal/StudioWidgets/LabeledSlider.lua

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ rbxGuiLibrary = require(script.Parent.RbxGui)
1010

1111
local kSliderWidth = 100
1212

13-
local kSliderThumbImage = "rbxasset://textures/RoactStudioWidgets/slider_caret.png"
14-
local kPreThumbImage = "rbxasset://textures/RoactStudioWidgets/slider_bar_dark.png"
13+
local kSliderThumbImage = "rbxasset://textures/RoactStudioWidgets/slider_handle_light.png"
14+
local kPreThumbImage = "rbxasset://textures/RoactStudioWidgets/slider_bar_light.png"
1515
local kPostThumbImage = "rbxasset://textures/RoactStudioWidgets/slider_bar_background_light.png"
1616

17+
local kSliderThumbImageDark = "rbxasset://textures/RoactStudioWidgets/slider_handle_dark.png"
18+
local kPreThumbImageDark = "rbxasset://textures/RoactStudioWidgets/slider_bar_dark.png"
19+
local kPostThumbImageDark = "rbxasset://textures/RoactStudioWidgets/slider_bar_background_dark.png"
20+
1721
local kThumbSize = 13
1822

1923
local kSteps = 100
@@ -102,7 +106,21 @@ function LabeledSliderClass.new(nameSuffix, labelText, sliderIntervals, defaultV
102106
slider.Size = UDim2.new(0, kSliderWidth, 1, 0)
103107
slider.Position = UDim2.new(0, GuiUtilities.StandardLineElementLeftMargin, 0, GuiUtilities.kStandardPropertyHeight/2)
104108
slider.Parent = frame
105-
109+
110+
local function updateImages()
111+
if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
112+
self._thumb.Image = kSliderThumbImageDark
113+
self._preThumbImage.Image = kPreThumbImageDark
114+
self._postThumbImage.Image = kPostThumbImageDark
115+
else
116+
self._thumb.Image = kSliderThumbImage
117+
self._preThumbImage.Image = kPreThumbImage
118+
self._postThumbImage.Image = kPostThumbImage
119+
end
120+
end
121+
settings().Studio.ThemeChanged:Connect(updateImages)
122+
updateImages()
123+
106124
return self
107125
end
108126

0 commit comments

Comments
 (0)