Is it possible to change the Studio theme using Command Bar/Plugin?

Recently I have been working on a plugin that gives you access to the Roblox Studio settings in an easier and intuitive way, I am very disappointed that I was unable to change the Roblox Studio theme using a plugin/command bar;

Some of my tries
settings().Studio.Theme = 'Dark'
settings().Studio.Theme = Enum.UITheme.Dark
settings().Studio.Theme = Enum.StudioStyleGuideColor.Dark

settings().Studio['UI Theme'] = 'Dark'
settings().Studio['UI Theme'] = Enum.UITheme.Dark
settings().Studio['UI Theme'] = Enum.StudioStyleGuideColor.Dark

I tried to do this in many ways, I even tried to use deprecated settings. What does not make me give up is that in the Developer Hub it says:

settings().Studio.Theme
“Used to get/set current theme used by Studio”

I may have misinterpreted it, or something is not right. I know about the existence of a StudioTheme class, but I still haven’t figured out how to modify or access it. I would therefore like to know if this is possible and how I can execute it, since this knowledge does not seem to be documented in the Developer Hub.

3 Likes

See below.

Archived response

No, not possible. You can modify colours but not the theme. Hypothetically you could change the theme but Theme expects a StudioTheme object which can’t be instanced.

StudioTheme is a read-only class that’s intended for you to know what theme is currently in use so you can reconfigure your plugin UIs and such. It also comes with an event, ThemeChanged, so you can change your own widget themes on the fly. It’s not intended for writing to. You’ll also notice this is why StudioTheme’s API only consists of getters and no setters.

Not sure why documentation includes set because you can’t.

1 Like

You should try looking through the code of this plugin, it is able to change the theme.
https://www.roblox.com/library/1858434956/Editor-Themes

1 Like

Theme here references the colour schema for your Script Editor window to create a “theme”. These can be changed because the properties expect a Color3 object when attempting to set. Not Theme (as in Light/Dark): that expects a StudioTheme object which you can’t create.

1 Like

I understood what theme meant, the plugin is able to toggle light/dark mode.

1 Like

Oh, is that so? If it actually can, then my bad, because I haven’t actually tested the plugin. I tried running a quick script from the command bar but it resulted in an error.

settings().Studio[“UI Theme”] = “Light”
01:54:32.019 - can’t set value

Could have to do with the security context level of plugins. Have you used this plugin before and can confirm that it’s able to switch Studio between light and dark mode? Seems that doesn’t coincide with OP’s testing but again, difference in security levels probably plays into that.

I just confirmed it does work.

EDIT: I figured out how this can be accomplished.

local studioThemes = settings().Studio:GetAvailableThemes() 
settings().Studio.Theme = studioThemes[1] -- light mode
settings().Studio.Theme = studioThemes[2] -- dark mode
8 Likes