23.9 C
New York
Monday, April 28, 2025

Godot Minimal 2.0 Theme by PassiveStar – GameFromScratch.com


Over the holidays, Passive Star released Godot Minimal Theme 2.0. I have used the Godot Minimal theme since was released in April 2024 and I still believe it makes Godot look his best (obviously this is a matter of opinion). Version 2.0 brings several new features:

several weeks ago Yuri Sizov He contacted me and suggested using a script built into the theme resource to combine the regular and HiDPI theme resources into one. Originally suggested embedding two (or more) theme fragments into a single resource and merging them using Theme.merge_with() depending on the settings of the selected editor.

After some discussion, we decided that instead of merging two resources, it makes more sense to just build everything entirely from code, as is done in the integrated theme. This provides the most control with the fewest lines.

This narrowed the topic down. 1.3K LOC (~150%)although now he does much more:

This is due to the fact that the high dpi file is no longer necessary because the theme can read the editor scaling from the editor settings to calculate the correct margins.

By the way yuri I also wrote an in-depth article on this idea, you can check it here!

The idea is simple: everything that goes into the _init() The resource script method is executed when the theme loads, so we can make calls to set_constant(), set_stylebox(), set_color()etc to generate the theme from the theme itself. Of course, since it’s GDScript, we can also read the editor settings like from any other tool script.

And it gets better – the _init() runs every time you change any of the theme-related settings in the editor settings. So when you change the base color or spacing values, Godot will regenerate the custom theme automatically using those values.

It took several hours to convert the topic from a resource to a script. But it took much longer to remove all the redundancy, make sure all the relevant editor settings were supported, and test everything.

Key links

Minimal Godot 2.0 Github Theme

PassiveStar blog on the topic

Yuri’s article on dynamic themes in Godot

You can learn more about Godot Minimal Theme 2.0, check out various versions of Godot since 1.1, and see the new theme in action at the video below.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles