Converts CSS to Godot Themes.
The goal is to make theme creating easier and more reusable. Using CSS you also have the advantage to use preprocessors like SASS.
masterbranch for godot 4godot-3.xbranch for godot 3 (might be out-dated)
- Download the plugin from the asset store
- Enable the plugin
Godot-CSS-Themein the Project Settings - Create a
cssfile and open it in the CSS tab (or some external tool) - Write your styles in css. See syntax below.
- Saving it automatically creates a theme that can be used
/* Base syntax */
Button {
--colors-font-color: #000;
--colors-font-color-disabled: Color(0, 0, 0, 0.5);
--const-hseparation: 5;
--fonts-font: url(res://font.tres);
--styles-normal-type: Flat;
--styles-normal-bg-color: #fff;
}
/* Simplified syntax */
Button {
color: #000;
backgroud: #fff;
}
Button:disabled {
color: Color(0, 0, 0, 0.5);
}See FEATURES for all supported features
If you see any problems or have any ideas for new features feel free to create an issue or a PR
Just make sure that new features are documented in FEATURES.md and that there is some kind of test for it.
base-syntax.css- should contain all possible styles that can be setsimple-syntax.css- should contain all simplified syntax that is supported
- Using colors with words like
redorbluedoes not work. Either use hex#000or native gdscriptColor(0, 0, 0, 1) - Only plain numbers are allowed, no
px,remetc. supported - Numbers cannot be shorted to e.g
.5, must be0.5
- This plugin itself cannot use css otherwise there might be problems enabling/disabling the plugin since it's depending on itself