Godot Themes - How could you use godot themes to change in-game UI, using GDScript

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RPG_Skyjogger

I was wondering, what is the best way, that the themes feature of Godot could be used to make a dark/light mode for our games UI.

Dark mode would be White Text on Black for example.

I imagine that there has to be a way that we could change these themes programmatically, such as in a settings menu in our project. This has been a concern, as it seems like you should be able to make a toggle for it (similar to some websites).

Is themes the correct way of implementing a feature of this caliber, or is there a better way of doing this?

:bust_in_silhouette: Reply From: Calinou

You can set the theme property on the root Control node programmatically; it trickles down to child Control nodes automatically. See also the Theming Override demo project.

You do not have to rely on the Default Project Theme project setting to change the theme. Instead, apply the Theme resource to the highest Control node in your project (or to every Control node root, if you have several Control roots).