GAMEFROMSCRATCH.COM
Godot Minimal Theme 2.0 from PassiveStar
Over the holidays Passive Star released the Godot Minimal Theme 2.0. I have used the Godot Minimal Theme since it was released back in April 2024 and I still believe that it makes Godot look about as good as possible (obviously this is a matter of opinion). The 2.0 release brings several new features to the fold:Several weeks agoYuri Sizovreached out to me and suggested using a built-in script on the theme resource itself to combine the regular and HiDPI theme resources into one. Originally he suggested to embed two (or more) theme chunks into a single resource and merge them together usingTheme.merge_with()depending on selected editor settings.After some discussion we decided that instead of merging two resources it makes more sense to just generate the whole thing entirely from code just like its done in the built-in theme. This gives the most control with the least amount of lines.This made the theme shrink by1.3K LOC (~150%), even though it does much more now:This is due to the fact that the high dpi file is not needed anymore because the theme can read editor scale from editor settings to calculate the correct margins.BtwYurialso wrote an in-depth article about this idea, you cancheck it out here!The idea is simple whatever goes into the_init()method of the resource script gets executed when the theme is loaded, so we can make calls toset_constant(),set_stylebox(),set_color(), etc to generate the theme from the theme itself. Of course since its GDScript we can also read editor settings from it just like from any other tool script.And it gets better the_init()runs every time any of the theme-related settings are changed in the editor settings. So when you change the base color or the spacing values godot will regenerate the custom theme automatically using those values.It took several hours to convert the theme from a resource to a script. But it took much longer than that to eliminate all of redundancy, make sure all of the relevant editor settings are supported and test everything.Key LinksGodot Minimal Theme 2.0 GithubPassiveStar Blog about the themeYuris Article on Dynamic Themes in GodotYou can learn more about the Godot Minimal Theme 2.0, see several versions of Godot going back to 1.1 and see the new theme in action in the video below.
0 Compartilhamentos
70 Visualizações