Skip to content

Commit 8afb2e5

Browse files
committed
Merge pull request #111118 from YeldhamDev/godots_new_groove
Add a new editor theme
2 parents 60f9409 + e06f015 commit 8afb2e5

27 files changed

+4887
-2381
lines changed

doc/classes/EditorSettings.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,9 @@
11071107
<member name="interface/theme/border_size" type="int" setter="" getter="">
11081108
The border size to use for interface elements (in pixels).
11091109
</member>
1110+
<member name="interface/theme/color_preset" type="String" setter="" getter="">
1111+
The editor color preset to use.
1112+
</member>
11101113
<member name="interface/theme/contrast" type="float" setter="" getter="">
11111114
The contrast factor to use when deriving the editor theme's base color (see [member interface/theme/base_color]). When using a positive values, the derived colors will be [i]darker[/i] than the base color. This contrast factor can be set to a negative value, which will make the derived colors [i]brighter[/i] than the base color. Negative contrast rates often look better for light themes.
11121115
</member>
@@ -1119,6 +1122,12 @@
11191122
<member name="interface/theme/draw_extra_borders" type="bool" setter="" getter="">
11201123
If [code]true[/code], draws additional borders around interactive UI elements in the editor. This is automatically enabled when using the [b]Black (OLED)[/b] theme preset, as this theme preset uses a fully black background.
11211124
</member>
1125+
<member name="interface/theme/draw_relationship_lines" type="int" setter="" getter="">
1126+
What relationship lines to draw in the editor's [Tree]-based GUIs (such as the Scene tree dock).
1127+
- [b]None[/b] will make it so that no relationship lines are drawn.
1128+
- [b]Selected Only[/b] will only draw them for selected items.
1129+
- [b]All[/b] will always draw them for all items.
1130+
</member>
11221131
<member name="interface/theme/follow_system_theme" type="bool" setter="" getter="">
11231132
If [code]true[/code], the editor theme preset will attempt to automatically match the system theme.
11241133
</member>
@@ -1132,15 +1141,15 @@
11321141
The saturation to use for editor icons. Higher values result in more vibrant colors.
11331142
[b]Note:[/b] The default editor icon saturation was increased by 30% in Godot 4.0 and later. To get Godot 3.x's icon saturation back, set [member interface/theme/icon_saturation] to [code]0.77[/code].
11341143
</member>
1135-
<member name="interface/theme/preset" type="String" setter="" getter="">
1136-
The editor theme preset to use.
1137-
</member>
11381144
<member name="interface/theme/relationship_line_opacity" type="float" setter="" getter="">
11391145
The opacity to use when drawing relationship lines in the editor's [Tree]-based GUIs (such as the Scene tree dock).
11401146
</member>
11411147
<member name="interface/theme/spacing_preset" type="String" setter="" getter="">
11421148
The editor theme spacing preset to use. See also [member interface/theme/base_spacing] and [member interface/theme/additional_spacing].
11431149
</member>
1150+
<member name="interface/theme/style" type="String" setter="" getter="">
1151+
The editor theme style to use.
1152+
</member>
11441153
<member name="interface/theme/use_system_accent_color" type="bool" setter="" getter="">
11451154
If [code]true[/code], set accent color based on system settings.
11461155
[b]Note:[/b] This setting is only effective on Windows, MacOS, and Android.

editor/audio/editor_audio_buses.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "scene/gui/separator.h"
4848
#include "scene/main/timer.h"
4949
#include "scene/resources/font.h"
50+
#include "scene/resources/style_box_flat.h"
5051
#include "servers/audio/audio_server.h"
5152

5253
void EditorAudioBus::_update_visible_channels() {
@@ -87,10 +88,11 @@ void EditorAudioBus::_notification(int p_what) {
8788

8889
disabled_vu = get_editor_theme_icon(SNAME("BusVuFrozen"));
8990

90-
Color solo_color = EditorThemeManager::is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.9, 1.74, 0.83);
91-
Color mute_color = EditorThemeManager::is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(2.35, 1.03, 1.03);
92-
Color bypass_color = EditorThemeManager::is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(1.03, 2.04, 2.35);
93-
float darkening_factor = EditorThemeManager::is_dark_theme() ? 0.15 : 0.65;
91+
bool dark_icon_and_font = EditorThemeManager::is_dark_icon_and_font();
92+
Color solo_color = dark_icon_and_font ? Color(1.0, 0.89, 0.22) : Color(1.9, 1.74, 0.83);
93+
Color mute_color = dark_icon_and_font ? Color(1.0, 0.16, 0.16) : Color(2.35, 1.03, 1.03);
94+
Color bypass_color = dark_icon_and_font ? Color(0.13, 0.8, 1.0) : Color(1.03, 2.04, 2.35);
95+
float darkening_factor = dark_icon_and_font ? 0.15 : 0.65;
9496
Color solo_color_darkened = solo_color.darkened(darkening_factor);
9597
Color mute_color_darkened = mute_color.darkened(darkening_factor);
9698
Color bypass_color_darkened = bypass_color.darkened(darkening_factor);

editor/docks/filesystem_dock.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ void FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
236236
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
237237

238238
if (has_custom_color) {
239-
subdirectory_item->set_icon_modulate(0, editor_is_dark_theme ? custom_color : custom_color * ITEM_COLOR_SCALE);
240-
subdirectory_item->set_custom_bg_color(0, Color(custom_color, editor_is_dark_theme ? ITEM_ALPHA_MIN : ITEM_ALPHA_MAX));
239+
subdirectory_item->set_icon_modulate(0, editor_is_dark_icon_and_font ? custom_color : custom_color * ITEM_COLOR_SCALE);
240+
subdirectory_item->set_custom_bg_color(0, Color(custom_color, editor_is_dark_icon_and_font ? ITEM_ALPHA_MIN : ITEM_ALPHA_MAX));
241241
} else {
242242
TreeItem *parent = subdirectory_item->get_parent();
243243
if (parent) {
@@ -630,9 +630,9 @@ void FileSystemDock::_notification(int p_what) {
630630
// Update editor dark theme & always show folders states from editor settings, redraw if needed.
631631
bool do_redraw = false;
632632

633-
bool new_editor_is_dark_theme = EditorThemeManager::is_dark_theme();
634-
if (new_editor_is_dark_theme != editor_is_dark_theme) {
635-
editor_is_dark_theme = new_editor_is_dark_theme;
633+
bool new_editor_is_dark_icon_and_font = EditorThemeManager::is_dark_icon_and_font();
634+
if (new_editor_is_dark_icon_and_font != editor_is_dark_icon_and_font) {
635+
editor_is_dark_icon_and_font = new_editor_is_dark_icon_and_font;
636636
do_redraw = true;
637637
}
638638

@@ -1080,7 +1080,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
10801080

10811081
files->set_item_metadata(-1, bd);
10821082
files->set_item_selectable(-1, false);
1083-
if (!editor_is_dark_theme && inherited_folder_color != default_folder_color) {
1083+
if (!editor_is_dark_icon_and_font && inherited_folder_color != default_folder_color) {
10841084
files->set_item_icon_modulate(-1, inherited_folder_color * ITEM_COLOR_SCALE);
10851085
} else {
10861086
files->set_item_icon_modulate(-1, inherited_folder_color);
@@ -1098,7 +1098,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
10981098
files->add_item(dname, folder_icon, true);
10991099
files->set_item_metadata(-1, dpath);
11001100
Color this_folder_color = has_custom_color ? folder_colors[assigned_folder_colors[dpath]] : inherited_folder_color;
1101-
if (!editor_is_dark_theme && this_folder_color != default_folder_color) {
1101+
if (!editor_is_dark_icon_and_font && this_folder_color != default_folder_color) {
11021102
this_folder_color *= ITEM_COLOR_SCALE;
11031103
}
11041104
files->set_item_icon_modulate(-1, this_folder_color);
@@ -3393,7 +3393,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
33933393
for (const KeyValue<String, Color> &E : folder_colors) {
33943394
folder_colors_menu->add_icon_item(get_editor_theme_icon(SNAME("Folder")), E.key.capitalize());
33953395

3396-
folder_colors_menu->set_item_icon_modulate(-1, editor_is_dark_theme ? E.value : E.value * 2);
3396+
folder_colors_menu->set_item_icon_modulate(-1, editor_is_dark_icon_and_font ? E.value : E.value * 2);
33973397
folder_colors_menu->set_item_metadata(-1, E.key);
33983398
}
33993399
}
@@ -4226,7 +4226,7 @@ FileSystemDock::FileSystemDock() {
42264226

42274227
assigned_folder_colors = ProjectSettings::get_singleton()->get_setting("file_customization/folder_colors");
42284228

4229-
editor_is_dark_theme = EditorThemeManager::is_dark_theme();
4229+
editor_is_dark_icon_and_font = EditorThemeManager::is_dark_icon_and_font();
42304230

42314231
VBoxContainer *main_vb = memnew(VBoxContainer);
42324232
add_child(main_vb);

editor/docks/filesystem_dock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class FileSystemDock : public EditorDock {
211211
bool always_show_folders = false;
212212
int thumbnail_size_setting = 0;
213213

214-
bool editor_is_dark_theme = false;
214+
bool editor_is_dark_icon_and_font = false;
215215

216216
class FileOrFolder {
217217
public:

editor/editor_node.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,8 @@ void EditorNode::_update_update_spinner() {
10961096
// as this feature should only be enabled for troubleshooting purposes.
10971097
// Make the icon modulate color overbright because icons are not completely white on a dark theme.
10981098
// On a light theme, icons are dark, so we need to modulate them with an even brighter color.
1099-
const bool dark_theme = EditorThemeManager::is_dark_theme();
1100-
update_spinner->set_self_modulate(theme->get_color(SNAME("error_color"), EditorStringName(Editor)) * (dark_theme ? Color(1.1, 1.1, 1.1) : Color(4.25, 4.25, 4.25)));
1099+
const bool dark_icon_and_font = EditorThemeManager::is_dark_icon_and_font();
1100+
update_spinner->set_self_modulate(theme->get_color(SNAME("error_color"), EditorStringName(Editor)) * (dark_icon_and_font ? Color(1.1, 1.1, 1.1) : Color(4.25, 4.25, 4.25)));
11011101
} else {
11021102
update_spinner->set_tooltip_text(TTRC("Spins when the editor window redraws."));
11031103
update_spinner->set_self_modulate(Color(1, 1, 1));

editor/gui/editor_dir_dialog.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "scene/gui/tree.h"
3939
#include "servers/display/display_server.h"
4040

41-
void EditorDirDialog::_update_dir(const Color &p_default_folder_color, const Dictionary &p_assigned_folder_colors, const HashMap<String, Color> &p_folder_colors, bool p_is_dark_theme, TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
41+
void EditorDirDialog::_update_dir(const Color &p_default_folder_color, const Dictionary &p_assigned_folder_colors, const HashMap<String, Color> &p_folder_colors, bool p_is_dark_icon_and_font, TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path) {
4242
updating = true;
4343

4444
const String path = p_dir->get_path();
@@ -58,8 +58,8 @@ void EditorDirDialog::_update_dir(const Color &p_default_folder_color, const Dic
5858

5959
if (p_assigned_folder_colors.has(path)) {
6060
const Color &folder_color = p_folder_colors[p_assigned_folder_colors[path]];
61-
p_item->set_icon_modulate(0, p_is_dark_theme ? folder_color : folder_color * FileSystemDock::ITEM_COLOR_SCALE);
62-
p_item->set_custom_bg_color(0, Color(folder_color, p_is_dark_theme ? FileSystemDock::ITEM_ALPHA_MIN : FileSystemDock::ITEM_ALPHA_MAX));
61+
p_item->set_icon_modulate(0, p_is_dark_icon_and_font ? folder_color : folder_color * FileSystemDock::ITEM_COLOR_SCALE);
62+
p_item->set_custom_bg_color(0, Color(folder_color, p_is_dark_icon_and_font ? FileSystemDock::ITEM_ALPHA_MIN : FileSystemDock::ITEM_ALPHA_MAX));
6363
} else {
6464
TreeItem *parent_item = p_item->get_parent();
6565
Color parent_bg_color = parent_item->get_custom_bg_color(0);
@@ -79,7 +79,7 @@ void EditorDirDialog::_update_dir(const Color &p_default_folder_color, const Dic
7979
updating = false;
8080
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
8181
TreeItem *ti = tree->create_item(p_item);
82-
_update_dir(p_default_folder_color, p_assigned_folder_colors, p_folder_colors, p_is_dark_theme, ti, p_dir->get_subdir(i));
82+
_update_dir(p_default_folder_color, p_assigned_folder_colors, p_folder_colors, p_is_dark_icon_and_font, ti, p_dir->get_subdir(i));
8383
}
8484
}
8585

@@ -107,7 +107,7 @@ void EditorDirDialog::reload(const String &p_path) {
107107

108108
tree->clear();
109109
TreeItem *root = tree->create_item();
110-
_update_dir(tree->get_theme_color(SNAME("folder_icon_color"), SNAME("FileDialog")), FileSystemDock::get_singleton()->get_assigned_folder_colors(), FileSystemDock::get_singleton()->get_folder_colors(), EditorThemeManager::is_dark_theme(), root, EditorFileSystem::get_singleton()->get_filesystem(), p_path);
110+
_update_dir(tree->get_theme_color(SNAME("folder_icon_color"), SNAME("FileDialog")), FileSystemDock::get_singleton()->get_assigned_folder_colors(), FileSystemDock::get_singleton()->get_folder_colors(), EditorThemeManager::is_dark_icon_and_font(), root, EditorFileSystem::get_singleton()->get_filesystem(), p_path);
111111
_item_collapsed(root);
112112
new_dir_path.clear();
113113
must_reload = false;

editor/gui/editor_dir_dialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class EditorDirDialog : public ConfirmationDialog {
5252

5353
void _item_collapsed(Object *p_item);
5454
void _item_activated();
55-
void _update_dir(const Color &p_default_folder_color, const Dictionary &p_assigned_folder_colors, const HashMap<String, Color> &p_folder_colors, bool p_is_dark_theme, TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path = String());
55+
void _update_dir(const Color &p_default_folder_color, const Dictionary &p_assigned_folder_colors, const HashMap<String, Color> &p_folder_colors, bool p_is_dark_icon_and_font, TreeItem *p_item, EditorFileSystemDirectory *p_dir, const String &p_select_path = String());
5656

5757
void _make_dir();
5858
void _make_dir_confirm(const String &p_path, const String &p_base_dir);

editor/gui/editor_object_selector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,8 @@ EditorObjectSelector::EditorObjectSelector(EditorSelectionHistory *p_history) {
208208
history = p_history;
209209

210210
MarginContainer *main_mc = memnew(MarginContainer);
211+
main_mc->set_theme_type_variation("ObjectSelectorMargin");
211212
main_mc->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
212-
main_mc->add_theme_constant_override("margin_left", 4 * EDSCALE);
213-
main_mc->add_theme_constant_override("margin_right", 6 * EDSCALE);
214213
add_child(main_mc);
215214

216215
HBoxContainer *main_hb = memnew(HBoxContainer);

editor/inspector/editor_inspector.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,6 +1978,8 @@ void EditorInspectorSection::_notification(int p_what) {
19781978

19791979
bg_color = theme_cache.prop_subsection;
19801980
bg_color.a /= level;
1981+
1982+
vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
19811983
} break;
19821984

19831985
case NOTIFICATION_SORT_CHILDREN: {
@@ -3551,7 +3553,7 @@ void EditorInspector::initialize_section_theme(EditorInspectorSection::ThemeCach
35513553
}
35523554

35533555
p_cache.horizontal_separation = p_control->get_theme_constant(SNAME("h_separation"), SNAME("EditorInspectorSection"));
3554-
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("Tree"));
3556+
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("EditorInspector"));
35553557
p_cache.inspector_margin = p_control->get_theme_constant(SNAME("inspector_margin"), EditorStringName(Editor));
35563558
p_cache.indent_size = p_control->get_theme_constant(SNAME("indent_size"), SNAME("EditorInspectorSection"));
35573559
p_cache.key_padding_size = int(EDITOR_GET("interface/theme/base_spacing")) * 2;
@@ -3590,7 +3592,7 @@ void EditorInspector::initialize_category_theme(EditorInspectorCategory::ThemeCa
35903592
}
35913593

35923594
p_cache.horizontal_separation = p_control->get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
3593-
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("Tree"));
3595+
p_cache.vertical_separation = p_control->get_theme_constant(SNAME("v_separation"), SNAME("EditorInspector"));
35943596
p_cache.class_icon_size = p_control->get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
35953597

35963598
p_cache.font_color = p_control->get_theme_color(SceneStringName(font_color), SNAME("Tree"));
@@ -3805,8 +3807,7 @@ void EditorInspector::_add_section_in_tree(EditorInspectorSection *p_section, VB
38053807
}
38063808
if (!container) {
38073809
container = memnew(VBoxContainer);
3808-
int separation = get_theme_constant(SNAME("v_separation"), SNAME("EditorInspector"));
3809-
container->add_theme_constant_override("separation", separation);
3810+
container->add_theme_constant_override("separation", theme_cache.vertical_separation);
38103811
p_current_vbox->add_child(container);
38113812
}
38123813
container->add_child(p_section);
@@ -4208,6 +4209,7 @@ void EditorInspector::update_tree() {
42084209
// Recreate the category vbox if it was reset.
42094210
if (category_vbox == nullptr) {
42104211
category_vbox = memnew(VBoxContainer);
4212+
category_vbox->add_theme_constant_override("separation", theme_cache.vertical_separation);
42114213
category_vbox->hide();
42124214
main_vbox->add_child(category_vbox);
42134215
}

editor/project_manager/project_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void ProjectManager::_update_theme(bool p_skip_creation) {
232232
main_vbox->add_theme_constant_override("separation", top_bar_separation);
233233

234234
background_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox("Background", EditorStringName(EditorStyles)));
235-
main_view_container->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), "TabContainer"));
235+
main_view_container->add_theme_style_override(SceneStringName(panel), get_theme_stylebox("panel_container", "ProjectManager"));
236236

237237
title_bar_logo->set_button_icon(get_editor_theme_icon("TitleBarLogo"));
238238

0 commit comments

Comments
 (0)