I’m trying to make a theme selector GUI where you can select different predefined themes and it will update them on the GUI. Other than cloning the menu and just changing the color scheme, what’s a good way to do this through a script?
EDIT: There are two solutions in this post. The one @amalnk0007 posted works, but it’s less performant and less efficient if you’re gonna be changing the menu(s) you want to add themes to constantly. The one @3rdhoan123 works too with more efficiency. I’d suggest picking out which one you think is easier for you. Anyways, thanks for coming by to read my post.
Sorry my reply didn’t exactly make sense. I’m guessing by the creating tables you mean setting the name of the UI element for the value name and then the color for the value? Still that would be tiring if you had a lot of UI elements in your menu.
Can’t really think of another really good way, unless you created a plugin of it and had it automatically paste it in as a table.
Basically:
Plugin copies color scheme from what you’ve done onto UI,
Plugin puts copy into table
You can use table to setup as scheme.
It probably might take a while to actually create the plugin but then you can probably create a load tons of color schemes fairly quickly with just simple clicks.
Make two Frames inside the Starter Gui and name them dark theme and light theme.
Also make sure make the UI’s inside that dark themed and light themed.(This will help you not to change the colour of the frames from the script)
Also make a text button named DarkTextButton.
(Script inside the text button)
local DarkTextButton = script.Parent
local darkTheme = DarkTextButton.Parent.DarkTheme
local lightTheme = DarkTextButton.Parent.LightTheme
if script.Parent.Name == "DarkTextButton" then -- this will check which theme to switch
DarkTextButton.MouseButton1Up:Connect(function()
darkTheme.Visible = false
lightTheme.Visible = true
DarkTextButton.Name = "LightTextButton"
end)
elseif script.Parent.Name == "LightTextButton" then
script.Parent.MouseButton1Up:Connect(function()
LightTheme.Visible = false
DarkTheme.Visible = true
script.Parent.Name == "DarkTextButton"
end)
end
That’s it.
I hope this works and I haven’t made any errors.
As I said in the post, I want a different way that isn’t cloning the default menu and changing the colors. However if it’s a easy solution, I guess I can try it. Plus I’m only storing two themes which are the ones you said (light and dark) so it shouldn’t be a bad thing.
I will make the other theme until I finish the default one so I don’t have to constantly make changes.
If you dont plan to change it at all, if you plan to leave your UI as is for a long time, not planning to add any large changes, etc.
Then it might be fine to do.
Other than that, adding any other themes, increasing scale, changing UI, its going to be a pain as it increases.
Dont know how performance will handle with two screenguis with one not being used though? Maybe it might be fine since one isnt visible but I dont really know much about it past that
Simple jist, thats the best way I could think of .
(Plus if you plan to change the colors, you can literally go to the table and change it and it’ll affect the GUI)