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

Commit b912e3b

Browse files
committed
Major theme changes.
1 parent 622cb62 commit b912e3b

File tree

7 files changed

+114
-46
lines changed

7 files changed

+114
-46
lines changed

src/Workspace/SignsInternal/PluginGui/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function PluginGui:newPluginGui(widgetGui)
5858
local textInput = LabeledTextInput.new( -- Asks user for text
5959
"textInput", -- name suffix of gui object
6060
"Text", -- title text of the multi choice
61-
"" -- default value
61+
"Text here" -- default value
6262
)
6363
textInput:SetMaxGraphemes(8192)
6464
textInput:GetFrame().Parent = textCollapse:GetContentsFrame()

src/Workspace/SignsInternal/StudioWidgets/CollapsibleTitledSection.lua

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,16 @@ 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.
121-
else
122120
titleBar.AutoButtonColor = false -- TODO: Set this to false when you implement a better solution.
121+
else
122+
titleBar.AutoButtonColor = false
123123
end
124124
titleBar.Name = 'TitleBarVisual'
125-
titleBar.BorderSizePixel = 0
126125
titleBar.Position = UDim2.new(0, 0, 0, 0)
127126
titleBar.Size = UDim2.new(1, 0, 0, self._titleBarHeight)
128127
titleBar.Parent = self._frame
129128
titleBar.LayoutOrder = 1
129+
GuiUtilities.syncGuiElementBorderColor(titleBar)
130130
GuiUtilities.syncGuiElementTitleColor(titleBar)
131131

132132
local titleLabel = Instance.new('TextLabel')
@@ -150,37 +150,63 @@ function CollapsibleTitledSectionClass:_CreateTitleBar(titleText)
150150
0, self._titleBarHeight*.5)
151151
self._minimizeButton.BackgroundTransparency = 1
152152
self._minimizeButton.Visible = self._minimizable -- only show when minimizable
153+
self._minimizeButton.Parent = titleBar
154+
155+
self._titleBar = titleBar
153156

154157
local function _UpdateMinimizeButtonTheme()
155-
if GuiUtilities:ShouldUseIconsForDarkerBackgrounds() == false then
156-
self._minimizeButton.ImageColor3 = Color3.fromRGB(0, 0, 0)
157-
else
158-
self._minimizeButton.ImageColor3 = Color3.fromRGB(237, 237, 237)
159-
end
158+
self._minimizeButton.ImageColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainText)
160159
end
161160
settings().Studio.ThemeChanged:Connect(_UpdateMinimizeButtonTheme)
162161
_UpdateMinimizeButtonTheme()
163162

164-
self._minimizeButton.MouseButton1Down:Connect(function()
165-
self:_ToggleCollapsedState()
163+
-- self._minimizeButton.MouseButton1Down:Connect(function()
164+
-- self:_ToggleCollapsedState()
165+
-- end)
166+
-- self:_UpdateMinimizeButton()
167+
-- self._minimizeButton.Parent = titleBar
168+
169+
titleBar.InputBegan:Connect(function(input)
170+
if (input.UserInputType == Enum.UserInputType.MouseMovement) then
171+
self._hovered = true
172+
self:_updateButtonVisual()
173+
end
174+
end)
175+
176+
titleBar.InputEnded:Connect(function(input)
177+
if (input.UserInputType == Enum.UserInputType.MouseMovement) then
178+
self._hovered = false
179+
self._clicked = false
180+
self:_updateButtonVisual()
181+
end
166182
end)
167-
self:_UpdateMinimizeButton()
168-
self._minimizeButton.Parent = titleBar
169183

170-
self._latestClickTime = 0
171184
titleBar.MouseButton1Down:Connect(function()
172-
-- commented out the code so it takes 1 click to open titlebar now instead of 2
185+
self._clicked = true
186+
self:_updateButtonVisual()
173187

174-
--local now = tick()
175-
--if (now - self._latestClickTime < kDoubleClickTimeSec) then
176188
if self._minimizable == true then -- if check was added in to fix bug. idk why this was left unfixed.
177189
self:_ToggleCollapsedState()
178190
end
179-
-- self._latestClickTime = 0
180-
--else
181-
-- self._latestClickTime = now
182-
--end
183191
end)
192+
193+
titleBar.MouseButton1Up:Connect(function()
194+
self._clicked = false
195+
self:_updateButtonVisual()
196+
end)
197+
end
198+
199+
function CollapsibleTitledSectionClass:_updateButtonVisual()
200+
local kTitlebarStandardBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Titlebar, Enum.StudioStyleGuideModifier.Default)
201+
local kTitlebarHoverBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Hover)
202+
203+
if (self._clicked) then
204+
self._titleBar.BackgroundColor3 = kTitlebarHoverBackgroundColor
205+
elseif (self._hovered) then
206+
self._titleBar.BackgroundColor3 = kTitlebarHoverBackgroundColor
207+
else
208+
self._titleBar.BackgroundColor3 = kTitlebarStandardBackgroundColor
209+
end
184210
end
185211

186212
return CollapsibleTitledSectionClass

src/Workspace/SignsInternal/StudioWidgets/CustomTextButton.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ function CustomTextButtonClass.new(buttonName, labelText)
2727
button.ScaleType = Enum.ScaleType.Slice
2828
button.SliceCenter = Rect.new(3, 3, 13, 13)
2929
button.AutoButtonColor = false
30+
GuiUtilities.syncGuiButtonColor(button)
3031

3132
local border = Instance.new('ImageLabel')
3233
border.Size = UDim2.new(1, 0, 1, 0)
34+
border.Name = "Border"
3335
border.BackgroundTransparency = 1
3436
border.ScaleType = Enum.ScaleType.Slice
3537
border.SliceCenter = Rect.new(3, 3, 13, 13)
3638
border.Image = kButtonBorder
3739
border.Parent = button
40+
GuiUtilities.syncGuiImageBorderColor(border)
3841

3942
local label = Instance.new('TextLabel')
4043
label.Text = labelText
@@ -43,6 +46,7 @@ function CustomTextButtonClass.new(buttonName, labelText)
4346
label.Font = Enum.Font.SourceSans
4447
label.TextSize = 15
4548
label.Parent = button
49+
GuiUtilities.syncGuiElementFontColor(label)
4650

4751
self._label = label
4852
self._border = border
@@ -58,7 +62,6 @@ function CustomTextButtonClass.new(buttonName, labelText)
5862
end
5963
end)
6064

61-
6265
button.InputEnded:Connect(function(input)
6366
if (input.UserInputType == Enum.UserInputType.MouseMovement) then
6467
self._hovered = false
@@ -76,29 +79,26 @@ function CustomTextButtonClass.new(buttonName, labelText)
7679
self._clicked = false
7780
self:_updateButtonVisual()
7881
end)
79-
80-
self:_updateButtonVisual()
8182

8283
return self
8384
end
8485

8586
function CustomTextButtonClass:_updateButtonVisual()
86-
self._border.ImageColor3 = GuiUtilities.kButtonStandardBorderColor
87-
if (self._clicked) then
88-
self._button.ImageColor3 = GuiUtilities.kButtonPressedBackgroundColor
89-
self._label.TextColor3 = GuiUtilities.kStandardButtonTextColor
90-
elseif (self._hovered) then
91-
self._button.ImageColor3 = GuiUtilities.kButtonHoverBackgroundColor
92-
self._label.TextColor3 = GuiUtilities.kStandardButtonTextColor
87+
local kButtonStandardBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Default)
88+
local kButtonPressedBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Pressed)
89+
local kButtonHoverBackgroundColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Hover)
90+
91+
if self._clicked then
92+
self._button.ImageColor3 = kButtonPressedBackgroundColor
93+
elseif self._hovered then
94+
self._button.ImageColor3 = kButtonHoverBackgroundColor
9395
else
94-
self._button.ImageColor3 = GuiUtilities.kButtonStandardBackgroundColor
95-
self._label.TextColor3 = GuiUtilities.kStandardButtonTextColor
96+
self._button.ImageColor3 = kButtonStandardBackgroundColor
9697
end
9798
end
9899

99100
function CustomTextButtonClass:GetButton()
100101
return self._button
101102
end
102103

103-
return CustomTextButtonClass
104-
104+
return CustomTextButtonClass

src/Workspace/SignsInternal/StudioWidgets/GuiUtilities.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module.kStandardFontSize = 15
1010
module.kStandardPropertyHeight = 30
1111
module.kSubSectionLabelHeight = 30
1212

13+
module.kStandardBorderColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Border, Enum.StudioStyleGuideModifier.Default)
14+
1315
module.kStandardVMargin = 7
1416
module.kStandardHMargin = 16
1517

@@ -30,7 +32,7 @@ module.kBottomButtonsFrameHeight = 50
3032
module.kBottomButtonsHeight = 28
3133

3234
module.kShapeButtonSize = 32
33-
module.kTextVerticalFudge = -3
35+
module.kTextVerticalFudge = 0
3436
module.kButtonVerticalFudge = -5
3537

3638
module.kBottomButtonsWidth = 100
@@ -127,6 +129,22 @@ function module.syncGuiElementScrollColor(guiElement)
127129
setColors()
128130
end
129131

132+
function module.syncGuiImageBorderColor(guiElement)
133+
local function setColors()
134+
guiElement.ImageColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Border, Enum.StudioStyleGuideModifier.Default)
135+
end
136+
settings().Studio.ThemeChanged:Connect(setColors)
137+
setColors()
138+
end
139+
140+
function module.syncGuiButtonColor(guiElement)
141+
local function setColors()
142+
guiElement.ImageColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Default)
143+
end
144+
settings().Studio.ThemeChanged:Connect(setColors)
145+
setColors()
146+
end
147+
130148
-- A frame with standard styling.
131149
function module.MakeFrame(name)
132150
local frame = Instance.new("Frame")

src/Workspace/SignsInternal/StudioWidgets/LabeledCheckbox.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,12 @@ function LabeledCheckboxClass.new(nameSuffix, labelText, initValue, initDisabled
7272
button.BackgroundTransparency = 1
7373
button.Position = UDim2.new(0, GuiUtilities.StandardLineElementLeftMargin, .5, 0)
7474
button.Parent = fullBackgroundButton
75-
button.Image = kCheckboxFrameImage
7675
button.BorderSizePixel = 0
7776
button.AutoButtonColor = false
7877

7978
local checkImage = Instance.new("ImageLabel")
8079
checkImage.Name = "CheckImage"
8180
checkImage.Parent = button
82-
checkImage.Image = kEnabledCheckImage
8381
checkImage.Visible = false
8482
checkImage.Size = kCheckImageSize
8583
checkImage.AnchorPoint = Vector2.new(0.5, 0.5)
@@ -108,8 +106,18 @@ function LabeledCheckboxClass.new(nameSuffix, labelText, initValue, initDisabled
108106
local function updateImages()
109107
if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
110108
self._button.Image = kCheckboxFrameImageDark
109+
if self._checkImage.Image == kDisabledCheckImage then
110+
self._checkImage.Image = kDisabledCheckImageDark
111+
else
112+
self._checkImage.Image = kEnabledCheckImageDark
113+
end
111114
else
112115
self._button.Image = kCheckboxFrameImage
116+
if self._checkImage.Image == kDisabledCheckImageDark then
117+
self._checkImage.Image = kDisabledCheckImage
118+
else
119+
self._checkImage.Image = kEnabledCheckImage
120+
end
113121
end
114122
end
115123
settings().Studio.ThemeChanged:Connect(updateImages)
@@ -187,7 +195,7 @@ function LabeledCheckboxClass:UseSmallSize()
187195
self._label.Position = kMinLabelPos
188196
self._label.TextXAlignment = Enum.TextXAlignment.Left
189197

190-
self._button.Size = kMinButtonSize
198+
self._button.Size = kMinButtonSize
191199
self._button.Position = kMinButtonPos
192200

193201
self._checkImage.Size = kMinCheckImageSize

src/Workspace/SignsInternal/StudioWidgets/LabeledTextInput.lua

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,38 @@ function LabeledTextInputClass.new(nameSuffix, labelText, defaultValue)
3939

4040
self._value = defaultValue
4141

42+
local textBoxBorder = Instance.new("ImageLabel")
43+
textBoxBorder.Name = "Border"
44+
textBoxBorder.Size = UDim2.new(0, kTextInputWidth, 0, kTextInputHeight)
45+
textBoxBorder.Position = UDim2.new(0, GuiUtilities.StandardLineElementLeftMargin, 0, 6)
46+
textBoxBorder.AnchorPoint = Vector2.new(0, 0)
47+
textBoxBorder.BackgroundTransparency = 1
48+
textBoxBorder.Image = "rbxasset://textures/StudioToolbox/RoundedBorder.png"
49+
textBoxBorder.ScaleType = Enum.ScaleType.Slice
50+
textBoxBorder.SliceCenter = Rect.new(3, 3, 13, 13)
51+
textBoxBorder.ImageColor3 = GuiUtilities.kStandardBorderColor
52+
textBoxBorder.AutomaticSize = Enum.AutomaticSize.Y
53+
textBoxBorder.Parent = frame
54+
GuiUtilities.syncGuiImageBorderColor(textBoxBorder)
55+
4256
-- Dumb hack to add padding to text box,
4357
local textBoxWrapperFrame = Instance.new("Frame")
4458
textBoxWrapperFrame.Name = "Wrapper"
45-
textBoxWrapperFrame.Size = UDim2.new(0, kTextInputWidth, 0, kTextInputHeight)
46-
textBoxWrapperFrame.Position = UDim2.new(0, GuiUtilities.StandardLineElementLeftMargin, 0, 6)
47-
textBoxWrapperFrame.AnchorPoint = Vector2.new(0, 0)
59+
textBoxWrapperFrame.Size = UDim2.new(0, kTextInputWidth - 2, 0, kTextInputHeight - 2)
60+
textBoxWrapperFrame.BorderSizePixel = 0
61+
textBoxWrapperFrame.AnchorPoint = Vector2.new(0.5, 0)
62+
textBoxWrapperFrame.Position = UDim2.new(0.5, 0, 0, 1)
4863
textBoxWrapperFrame.AutomaticSize = Enum.AutomaticSize.Y
49-
textBoxWrapperFrame.Parent = frame
64+
textBoxWrapperFrame.Parent = textBoxBorder
5065
GuiUtilities.syncGuiElementInputFieldColor(textBoxWrapperFrame)
51-
GuiUtilities.syncGuiElementBorderColor(textBoxWrapperFrame)
5266

5367
local textBox = Instance.new("TextBox")
5468
textBox.Parent = textBoxWrapperFrame
5569
textBox.Name = "TextBox"
5670
textBox.ClearTextOnFocus = false
5771
textBox.MultiLine = true
58-
textBox.Text = defaultValue
72+
textBox.Text = ""
73+
textBox.PlaceholderText = defaultValue
5974
textBox.Font = Enum.Font.SourceSans
6075
textBox.TextSize = 15
6176
textBox.TextWrapped = true

src/Workspace/SignsInternal/StudioWidgets/VerticalScrollingFrame.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ function VerticalScrollingFrame.new(suffix)
1919
section.BorderSizePixel = 0
2020
section.Size = UDim2.new(1, 0, 1, 0)
2121
section.Position = UDim2.new(0, 0, 0, 0)
22-
section.BackgroundTransparency = 1
22+
section.BackgroundTransparency = 0
2323
section.Name = "VerticalScrollFrame" .. suffix
24+
GuiUtilities.syncGuiElementBackgroundColor(section)
2425

2526
local scrollBackground = Instance.new("Frame")
2627
scrollBackground.Name = "ScrollbarBackground"

0 commit comments

Comments
 (0)