local z=6.1/#themeColors local p=pages.custom["\065\066 \084\104\101\109\101\083\101\108\101\099\116\105\111\110"]local R=true local function W(z,R)if z==nil then for p,W in pairs(themeColors)do if W[1]==main.pdata.Theme then z=W[1]R=W[2]break end end end if z then local W={}for z,p in pairs(main.gui:GetDescendants())do if p:IsA("\066\111\111\108\086\097\108\117\101")and p.Name=="\084\104\101\109\101"then table.insert(W,p.Parent)end end for z,p in pairs(W)do local W=R if p.Theme.Value then local z,p,s=Color3.toHSV(R)W=Color3.fromHSV(z,p,s*1.35)end if p:IsA("\084\101\120\116\076\097\098\101\108")then local z,s,k=Color3.toHSV(R)W=Color3.fromHSV(z,s,k*2)p.TextColor3=W else p.BackgroundColor3=W end end for p,R in pairs(p:GetChildren())do if R:IsA("\084\101\120\116\066\117\116\116\111\110")then if R.Name==z then R.BorderSizePixel=1 else R.BorderSizePixel=0 end end end end end for s,k in pairs(themeColors)do local m=k[1]local V=k[2]local Q=p.ThemeTemplate:Clone()Q.Name=m Q.UIAspectRatioConstraint.AspectRatio=z Q.BackgroundColor3=V Q.MouseButton1Down:Connect(function()if R then R=false main.signals.ChangeSetting:InvokeServer({"\084\104\101\109\101";m})W(m,V)R=true end end)Q.Visible=true Q.Parent=p end
-- << CUSTOM >>
-- Theme
local ratio = 6.1 / #themeColors
local themeFrame = pages.custom["AB ThemeSelection"]
local themeDe = true
local function updateThemeSelection(themeName, themeColor)
	if themeName == nil then
		for i, v in pairs(themeColors) do
			if v[1] == main.pdata.Theme then
				themeName = v[1]
				themeColor = v[2]
				break
			end
		end
	end
	if themeName then
		local themeFrames = {}
		for a, b in pairs(main.gui:GetDescendants()) do
			if b:IsA("BoolValue") and b.Name == "Theme" then
				table.insert(themeFrames, b.Parent)
			end
		end
		for _, f in pairs(themeFrames) do
			local newThemeColor = themeColor
			if f.Theme.Value then
				local h, s, v = Color3.toHSV(themeColor)
				newThemeColor = Color3.fromHSV(h, s, v * 1.35)
			end
			if f:IsA("TextLabel") then
				local h, s, v = Color3.toHSV(themeColor)
				newThemeColor = Color3.fromHSV(h, s, v * 2)
				f.TextColor3 = newThemeColor
			else
				f.BackgroundColor3 = newThemeColor
			end
		end
		for a, b in pairs(themeFrame:GetChildren()) do
			if b:IsA("TextButton") then
				if b.Name == themeName then
					b.BorderSizePixel = 1
				else
					b.BorderSizePixel = 0
				end
			end
		end
	end
end
for i, theme in pairs(themeColors) do
	local themeName = theme[1]
	local themeColor = theme[2]
	local box = themeFrame.ThemeTemplate:Clone()
	box.Name = themeName
	box.UIAspectRatioConstraint.AspectRatio = ratio
	box.BackgroundColor3 = themeColor
	box.MouseButton1Down:Connect(function()
		if themeDe then
			themeDe = false
			main.signals.ChangeSetting:InvokeServer({ "Theme", themeName })
			updateThemeSelection(themeName, themeColor)
			themeDe = true
		end
	end)
	box.Visible = true
	box.Parent = themeFrame
end
