Allow modification of the color for the checkbox's checked and unchecked icons

Occasionally, the default white color for the icon does not meet our needs, and we would like to change it. However, the CheckBox does not currently have a mechanism to modify this color.
This commit is contained in:
Nông Văn Tình
2024-08-18 14:09:06 +07:00
parent b9437c3938
commit 4632cfd4bd
7 changed files with 34 additions and 4 deletions

View File

@ -326,6 +326,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("check_v_offset", "CheckBox", 0);
theme->set_constant("outline_size", "CheckBox", 0);
theme->set_color("checkbox_checked_color", "CheckBox", Color(1, 1, 1));
theme->set_color("checkbox_unchecked_color", "CheckBox", Color(1, 1, 1));
// CheckButton
Ref<StyleBox> cb_empty = memnew(StyleBoxEmpty);
@ -363,6 +366,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("check_v_offset", "CheckButton", 0);
theme->set_constant("outline_size", "CheckButton", 0);
theme->set_color("button_checked_color", "CheckButton", Color(1, 1, 1));
theme->set_color("button_unchecked_color", "CheckButton", Color(1, 1, 1));
// Button variations
theme->set_type_variation(SceneStringName(FlatButton), "Button");