summaryrefslogtreecommitdiff
path: root/editor/editor_themes.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-10 10:52:44 +0200
committerGitHub <noreply@github.com>2022-06-10 10:52:44 +0200
commitab2fd4a671124c69ac613437819daf7510b6f0eb (patch)
tree00f32f14b9234633c2b0c593e3e3c0ed1225aa47 /editor/editor_themes.cpp
parent1f76ee408088090b586d611ff6a337989a159269 (diff)
parent42d1a969046f9a92a63ef2335ef5486e79d69ac4 (diff)
Merge pull request #59776 from fire-forge/more-round
Diffstat (limited to 'editor/editor_themes.cpp')
-rw-r--r--editor/editor_themes.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 3c3fe77e28..2131365d59 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -692,6 +692,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_canvas_editor_info->set_expand_margin_size_all(4 * EDSCALE);
theme->set_stylebox("CanvasItemInfoOverlay", "EditorStyles", style_canvas_editor_info);
+ // 2D and 3D contextual toolbar.
+ // Use a custom stylebox to make contextual menu items stand out from the rest.
+ // This helps with editor usability as contextual menu items change when selecting nodes,
+ // even though it may not be immediately obvious at first.
+ Ref<StyleBoxFlat> toolbar_stylebox = memnew(StyleBoxFlat);
+ toolbar_stylebox->set_bg_color(accent_color * Color(1, 1, 1, 0.1));
+ toolbar_stylebox->set_corner_radius(CORNER_TOP_LEFT, corner_radius * EDSCALE);
+ toolbar_stylebox->set_corner_radius(CORNER_TOP_RIGHT, corner_radius * EDSCALE);
+ toolbar_stylebox->set_anti_aliased(false);
+ // Add an underline to the StyleBox, but prevent its minimum vertical size from changing.
+ toolbar_stylebox->set_border_color(accent_color);
+ toolbar_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE));
+ toolbar_stylebox->set_default_margin(SIDE_BOTTOM, 0);
+ theme->set_stylebox("ContextualToolbar", "EditorStyles", toolbar_stylebox);
+
// Script Editor
theme->set_stylebox("ScriptEditorPanel", "EditorStyles", make_empty_stylebox(default_margin_size, 0, default_margin_size, default_margin_size));
theme->set_stylebox("ScriptEditor", "EditorStyles", make_empty_stylebox(0, 0, 0, 0));