-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThemeManager.lua
More file actions
350 lines (316 loc) · 11.8 KB
/
ThemeManager.lua
File metadata and controls
350 lines (316 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
local ThemeManager = {}
ThemeManager.Decorations = {
["LeftWing"] = {
AssetId = "rbxassetid://128923622323769",
Position = UDim2.new(0, -150, 0.5, -75),
Size = UDim2.new(0, 150, 0, 150),
Transparency = 0.4,
Rotation = 0,
ZIndex = -1
},
["RightWing"] = {
AssetId = "rbxassetid://0",
Position = UDim2.new(1, 0, 0.5, -75),
Size = UDim2.new(0, 150, 0, 150),
Transparency = 0.4,
Rotation = 0,
ZIndex = -1
}
}
ThemeManager.Themes = {
["Violet"] = {
MainColor = Color3.fromRGB(70, 50, 120),
SelectionColor = Color3.fromRGB(150, 100, 255),
GlowColor = Color3.fromRGB(180, 100, 255),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(85, 60, 140),
GradientEnd = Color3.fromRGB(50, 30, 90),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
CustomDecorations = ThemeManager.Decorations
},
["Smoke"] = {
MainColor = Color3.fromRGB(45, 50, 55),
SelectionColor = Color3.fromRGB(200, 200, 200),
GlowColor = Color3.fromRGB(220, 220, 220),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(55, 60, 65),
GradientEnd = Color3.fromRGB(30, 35, 40),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
CustomDecorations = {}
},
["Scarlet"] = {
MainColor = Color3.fromRGB(120, 30, 40),
SelectionColor = Color3.fromRGB(255, 80, 80),
GlowColor = Color3.fromRGB(255, 60, 60),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(140, 40, 50),
GradientEnd = Color3.fromRGB(90, 20, 30),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
CustomDecorations = {}
},
["Aqua"] = {
MainColor = Color3.fromRGB(45, 85, 100),
SelectionColor = Color3.fromRGB(100, 200, 255),
GlowColor = Color3.fromRGB(80, 220, 255),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(55, 105, 120),
GradientEnd = Color3.fromRGB(30, 65, 80),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
CustomDecorations = {}
},
["Lemon"] = {
MainColor = Color3.fromRGB(130, 120, 40),
SelectionColor = Color3.fromRGB(255, 235, 100),
GlowColor = Color3.fromRGB(255, 245, 80),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(150, 140, 50),
GradientEnd = Color3.fromRGB(100, 90, 30),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
CustomDecorations = {}
},
["Light"] = {
MainColor = Color3.fromRGB(210, 210, 210),
SelectionColor = Color3.fromRGB(100, 100, 100),
GlowColor = Color3.fromRGB(80, 80, 80),
BoundaryColor = Color3.fromRGB(0, 0, 0),
BoundaryTransparency = 0.8,
Transparency = 0.15,
GradientStart = Color3.fromRGB(220, 225, 230),
GradientEnd = Color3.fromRGB(180, 185, 190),
TextColor = Color3.fromRGB(20, 20, 20),
DescTextColor = Color3.fromRGB(40, 40, 40),
ClipboardIcon = "rbxassetid://75034952969786",
CustomDecorations = {}
},
["Rose"] = {
MainColor = Color3.fromRGB(120, 50, 80),
SelectionColor = Color3.fromRGB(255, 120, 180),
GlowColor = Color3.fromRGB(255, 100, 160),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(140, 60, 95),
GradientEnd = Color3.fromRGB(90, 35, 60),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
CustomDecorations = {}
},
["Custom"] = {
MainColor = Color3.fromRGB(40, 45, 50),
SelectionColor = Color3.fromRGB(200, 200, 200),
GlowColor = Color3.fromRGB(255, 255, 255),
BoundaryColor = Color3.fromRGB(255, 255, 255),
BoundaryTransparency = 0.8,
Transparency = 0.3,
GradientStart = Color3.fromRGB(50, 55, 60),
GradientEnd = Color3.fromRGB(25, 30, 35),
TextColor = Color3.fromRGB(255, 255, 255),
DescTextColor = Color3.fromRGB(230, 240, 245),
ClipboardIcon = "rbxassetid://106330002535278",
AssetId = "rbxassetid://86981028005920",
CustomDecorations = {}
}
}
ThemeManager.CurrentTheme = "Smoke"
ThemeManager.OverlayInstance = nil
ThemeManager.ImageInstance = nil
ThemeManager.RegisteredContainers = {}
ThemeManager.RegisteredTabs = {}
function ThemeManager:GetTheme(name)
return self.Themes[name or self.CurrentTheme] or self.Themes["Smoke"]
end
function ThemeManager:GetContainerColor(theme)
local r = math.clamp(theme.MainColor.R + 25/255, 0, 1)
local g = math.clamp(theme.MainColor.G + 20/255, 0, 1)
local b = math.clamp(theme.MainColor.B + 15/255, 0, 1)
return Color3.new(r, g, b)
end
function ThemeManager:GetContainerStrokeColor(theme)
local r = math.clamp(theme.SelectionColor.R * 0.6, 0, 1)
local g = math.clamp(theme.SelectionColor.G * 0.78, 0, 1)
local b = math.clamp(theme.SelectionColor.B * 0.86, 0, 1)
return Color3.new(r, g, b)
end
function ThemeManager:RegisterContainer(itemFrame, stroke)
table.insert(self.RegisteredContainers, {Frame = itemFrame, Stroke = stroke})
end
function ThemeManager:RegisterTab(tabButton)
table.insert(self.RegisteredTabs, tabButton)
end
function ThemeManager:ApplyThemeImage(targetUI, assetId)
if not self.ImageInstance then
self.ImageInstance = Instance.new("ImageLabel")
self.ImageInstance.Name = "ThemeImage"
self.ImageInstance.Size = UDim2.new(1, 0, 1, 0)
self.ImageInstance.BackgroundTransparency = 1
self.ImageInstance.ScaleType = Enum.ScaleType.Tile
self.ImageInstance.TileSize = UDim2.new(0, 450, 0, 300)
self.ImageInstance.ZIndex = 0
local Corner = Instance.new("UICorner")
Corner.CornerRadius = UDim.new(0, 12)
Corner.Parent = self.ImageInstance
end
self.ImageInstance.Image = assetId
self.ImageInstance.Parent = targetUI
end
function ThemeManager:SetTheme(name, targetUI, customAssetId)
local theme = self:GetTheme(name)
self.CurrentTheme = name
if targetUI and targetUI:IsA("Frame") then
targetUI.BackgroundColor3 = theme.MainColor
targetUI.BackgroundTransparency = theme.Transparency or 0.3
local gradientBg = targetUI:FindFirstChild("GradientBackground")
if gradientBg then
local uiGradient = gradientBg:FindFirstChildOfClass("UIGradient")
if uiGradient then
uiGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, theme.GradientStart or theme.MainColor),
ColorSequenceKeypoint.new(1, theme.GradientEnd or theme.MainColor)
}
end
end
local blurBg = targetUI:FindFirstChild("BlurBackground")
if blurBg then
blurBg.BackgroundColor3 = theme.MainColor
end
if name == "Custom" and customAssetId then
theme.AssetId = customAssetId
self:ApplyThemeImage(targetUI, customAssetId)
elseif theme.AssetId and theme.AssetId ~= "" then
self:ApplyThemeImage(targetUI, theme.AssetId)
elseif self.ImageInstance then
self.ImageInstance.Parent = nil
end
for _, child in ipairs(targetUI:GetDescendants()) do
if child:IsA("ImageLabel") and ThemeManager.Decorations and ThemeManager.Decorations[child.Name] then
local data = ThemeManager.Decorations[child.Name]
child.ImageColor3 = data.Color or Color3.fromRGB(255, 255, 255)
child.ImageTransparency = data.Transparency or 0.4
child.Position = data.Position
child.Size = data.Size
end
end
-- Update control buttons (X, ▢, —)
local controlButtons = targetUI:FindFirstChild("ControlButtons")
if controlButtons then
local closeBtn = controlButtons:FindFirstChild("CloseButton")
local maxBtn = controlButtons:FindFirstChild("MaximizeButton")
local minBtn = controlButtons:FindFirstChild("MinimizeButton")
if closeBtn then closeBtn.TextColor3 = theme.TextColor end
if maxBtn then maxBtn.TextColor3 = theme.TextColor end
if minBtn then minBtn.TextColor3 = theme.TextColor end
end
end
local containerColor = self:GetContainerColor(theme)
local strokeColor = self:GetContainerStrokeColor(theme)
local textColor = theme.TextColor or Color3.fromRGB(255, 255, 255)
local descTextColor = theme.DescTextColor or Color3.fromRGB(230, 240, 245)
for _, tabButton in ipairs(self.RegisteredTabs) do
if tabButton and tabButton.Parent then
tabButton.TextColor3 = textColor
end
end
for _, entry in ipairs(self.RegisteredContainers) do
if entry.Frame and entry.Frame.Parent then
entry.Frame.BackgroundColor3 = containerColor
entry.Stroke.Color = strokeColor
for _, child in ipairs(entry.Frame:GetDescendants()) do
if child:IsA("TextLabel") or child:IsA("TextButton") then
if child.Name == "Title" then
child.TextColor3 = textColor
elseif child.Name == "Description" then
child.TextColor3 = descTextColor
elseif child.Name == "ValueLabel" then
child.TextColor3 = textColor
end
elseif child:IsA("ImageLabel") and child.Name == "Arrow" then
child.Image = theme.ClipboardIcon or "rbxassetid://106330002535278"
end
end
end
end
end
function ThemeManager:SetComponentColor(componentType, color, objects)
local theme = self:GetTheme(self.CurrentTheme)
if componentType == "Selection" then
theme.SelectionColor = color
elseif componentType == "Glow" then
theme.GlowColor = color
elseif componentType == "Boundary" then
theme.BoundaryColor = color
end
for _, obj in ipairs(objects) do
if obj:IsA("Frame") or obj:IsA("TextButton") then
obj.BackgroundColor3 = color
elseif obj:IsA("ImageLabel") and theme.CustomDecorations and theme.CustomDecorations[obj.Name] then
obj.ImageColor3 = color
end
end
end
function ThemeManager:SetComponentTransparency(componentType, value, objects)
local theme = self:GetTheme(self.CurrentTheme)
if componentType == "Boundary" then
theme.BoundaryTransparency = value
end
for _, obj in ipairs(objects) do
if obj:IsA("Frame") then
obj.BackgroundTransparency = value
elseif obj:IsA("ImageLabel") and theme.CustomDecorations and theme.CustomDecorations[obj.Name] then
obj.ImageTransparency = value
end
end
end
function ThemeManager:SetTransparency(value, targetUI)
local theme = self:GetTheme(self.CurrentTheme)
theme.Transparency = value
if targetUI and targetUI:IsA("Frame") then
targetUI.BackgroundTransparency = value
local blurBg = targetUI:FindFirstChild("BlurBackground")
if blurBg then
blurBg.BackgroundTransparency = math.clamp(value - 0.05, 0, 1)
end
end
end
function ThemeManager:SetAcrylic(enabled, targetScreenGui)
if enabled and targetScreenGui then
if not self.OverlayInstance then
self.OverlayInstance = Instance.new("Frame")
self.OverlayInstance.Name = "AcrylicOverlay"
self.OverlayInstance.Size = UDim2.new(1, 0, 1, 0)
self.OverlayInstance.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
self.OverlayInstance.BackgroundTransparency = 0.95
self.OverlayInstance.ZIndex = -3
self.OverlayInstance.Parent = targetScreenGui:FindFirstChild("MainFrame") or targetScreenGui
local Corner = Instance.new("UICorner")
Corner.CornerRadius = UDim.new(0, 12)
Corner.Parent = self.OverlayInstance
end
else
if self.OverlayInstance then
self.OverlayInstance:Destroy()
self.OverlayInstance = nil
end
end
end
return ThemeManager