summaryrefslogtreecommitdiff
path: root/editor/editor_themes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_themes.cpp')
-rw-r--r--editor/editor_themes.cpp147
1 files changed, 82 insertions, 65 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 1fea759a90..3b159d9f3d 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -148,7 +148,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
// The names of the icons to never convert, even if one of their colors
// are contained in the dictionary above.
- Set<StringName> exceptions;
+ RBSet<StringName> exceptions;
// Some of the colors below are listed for completeness sake.
// This can be a basis for proper palette validation later.
@@ -290,7 +290,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
// Use the accent color for some icons (checkbox, radio, toggle, etc.).
Dictionary accent_color_icon_color_dictionary;
- Set<StringName> accent_color_icons;
+ RBSet<StringName> accent_color_icons;
const Color accent_color = p_theme->get_color(SNAME("accent_color"), SNAME("Editor"));
accent_color_icon_color_dictionary[Color::html("699ce8")] = accent_color;
@@ -489,6 +489,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("axis_x_color", "Editor", Color(0.96, 0.20, 0.32));
theme->set_color("axis_y_color", "Editor", Color(0.53, 0.84, 0.01));
theme->set_color("axis_z_color", "Editor", Color(0.16, 0.55, 0.96));
+ theme->set_color("axis_w_color", "Editor", Color(0.55, 0.55, 0.55));
const float prop_color_saturation = accent_color.get_s() * 0.75;
const float prop_color_value = accent_color.get_v();
@@ -740,17 +741,28 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("pressed", "EditorLogFilterButton", editor_log_button_pressed);
// OptionButton
- theme->set_stylebox("focus", "OptionButton", style_widget_focus);
-
+ Ref<StyleBoxFlat> style_option_button_focus = style_widget_focus->duplicate();
+ Ref<StyleBoxFlat> style_option_button_normal = style_widget->duplicate();
+ Ref<StyleBoxFlat> style_option_button_hover = style_widget_hover->duplicate();
+ Ref<StyleBoxFlat> style_option_button_pressed = style_widget_pressed->duplicate();
+ Ref<StyleBoxFlat> style_option_button_disabled = style_widget_disabled->duplicate();
+
+ style_option_button_focus->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_normal->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_hover->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_pressed->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+ style_option_button_disabled->set_default_margin(SIDE_RIGHT, 4 * EDSCALE);
+
+ theme->set_stylebox("focus", "OptionButton", style_option_button_focus);
theme->set_stylebox("normal", "OptionButton", style_widget);
theme->set_stylebox("hover", "OptionButton", style_widget_hover);
theme->set_stylebox("pressed", "OptionButton", style_widget_pressed);
theme->set_stylebox("disabled", "OptionButton", style_widget_disabled);
- theme->set_stylebox("normal_mirrored", "OptionButton", style_widget);
- theme->set_stylebox("hover_mirrored", "OptionButton", style_widget_hover);
- theme->set_stylebox("pressed_mirrored", "OptionButton", style_widget_pressed);
- theme->set_stylebox("disabled_mirrored", "OptionButton", style_widget_disabled);
+ theme->set_stylebox("normal_mirrored", "OptionButton", style_option_button_normal);
+ theme->set_stylebox("hover_mirrored", "OptionButton", style_option_button_hover);
+ theme->set_stylebox("pressed_mirrored", "OptionButton", style_option_button_pressed);
+ theme->set_stylebox("disabled_mirrored", "OptionButton", style_option_button_disabled);
theme->set_color("font_color", "OptionButton", font_color);
theme->set_color("font_hover_color", "OptionButton", font_hover_color);
@@ -762,7 +774,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("arrow", "OptionButton", theme->get_icon(SNAME("GuiOptionArrow"), SNAME("EditorIcons")));
theme->set_constant("arrow_margin", "OptionButton", widget_default_margin.x - 2 * EDSCALE);
theme->set_constant("modulate_arrow", "OptionButton", true);
- theme->set_constant("hseparation", "OptionButton", 4 * EDSCALE);
+ theme->set_constant("h_separation", "OptionButton", 4 * EDSCALE);
// CheckButton
theme->set_stylebox("normal", "CheckButton", style_menu);
@@ -788,8 +800,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("icon_hover_color", "CheckButton", icon_hover_color);
theme->set_color("icon_focus_color", "CheckButton", icon_focus_color);
- theme->set_constant("hseparation", "CheckButton", 8 * EDSCALE);
- theme->set_constant("check_vadjust", "CheckButton", 0 * EDSCALE);
+ theme->set_constant("h_separation", "CheckButton", 8 * EDSCALE);
+ theme->set_constant("check_v_adjust", "CheckButton", 0 * EDSCALE);
// Checkbox
Ref<StyleBoxFlat> sb_checkbox = style_menu->duplicate();
@@ -819,8 +831,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("icon_hover_color", "CheckBox", icon_hover_color);
theme->set_color("icon_focus_color", "CheckBox", icon_focus_color);
- theme->set_constant("hseparation", "CheckBox", 8 * EDSCALE);
- theme->set_constant("check_vadjust", "CheckBox", 0 * EDSCALE);
+ theme->set_constant("h_separation", "CheckBox", 8 * EDSCALE);
+ theme->set_constant("check_v_adjust", "CheckBox", 0 * EDSCALE);
// PopupDialog
theme->set_stylebox("panel", "PopupDialog", style_popup);
@@ -868,12 +880,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("visibility_visible", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")));
theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityXray"), SNAME("EditorIcons")));
- // Force the vseparation to be even so that the spacing on top and bottom is even.
+ // Force the v_separation to be even so that the spacing on top and bottom is even.
// If the vsep is odd and cannot be split into 2 even groups (of pixels), then it will be lopsided.
// We add 2 to the vsep to give it some extra spacing which looks a bit more modern (see Windows, for example)
int vsep_base = extra_spacing + default_margin_size + 2;
int force_even_vsep = vsep_base + (vsep_base % 2);
- theme->set_constant("vseparation", "PopupMenu", force_even_vsep * EDSCALE);
+ theme->set_constant("v_separation", "PopupMenu", force_even_vsep * EDSCALE);
theme->set_constant("item_start_padding", "PopupMenu", popup_menu_margin_size * EDSCALE);
theme->set_constant("item_end_padding", "PopupMenu", popup_menu_margin_size * EDSCALE);
@@ -929,7 +941,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("font_offset", "EditorProperty", 8 * EDSCALE);
theme->set_stylebox("bg_selected", "EditorProperty", style_property_bg);
theme->set_stylebox("bg", "EditorProperty", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty)));
- theme->set_constant("vseparation", "EditorProperty", (extra_spacing + default_margin_size) * EDSCALE);
+ theme->set_constant("v_separation", "EditorProperty", (extra_spacing + default_margin_size) * EDSCALE);
theme->set_color("warning_color", "EditorProperty", warning_color);
theme->set_color("property_color", "EditorProperty", property_color);
theme->set_color("readonly_color", "EditorProperty", readonly_color);
@@ -977,8 +989,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_selected_color", "Tree", mono_color);
theme->set_color("title_button_color", "Tree", font_color);
theme->set_color("drop_position_color", "Tree", accent_color);
- theme->set_constant("vseparation", "Tree", widget_default_margin.y - EDSCALE);
- theme->set_constant("hseparation", "Tree", 6 * EDSCALE);
+ theme->set_constant("v_separation", "Tree", widget_default_margin.y - EDSCALE);
+ theme->set_constant("h_separation", "Tree", 6 * EDSCALE);
theme->set_constant("guide_width", "Tree", border_width);
theme->set_constant("item_margin", "Tree", 3 * default_margin_size * EDSCALE);
theme->set_constant("button_margin", "Tree", default_margin_size * EDSCALE);
@@ -1068,8 +1080,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_color", "ItemList", font_color);
theme->set_color("font_selected_color", "ItemList", mono_color);
theme->set_color("guide_color", "ItemList", guide_color);
- theme->set_constant("vseparation", "ItemList", widget_default_margin.y - EDSCALE);
- theme->set_constant("hseparation", "ItemList", 6 * EDSCALE);
+ theme->set_constant("v_separation", "ItemList", widget_default_margin.y - EDSCALE);
+ theme->set_constant("h_separation", "ItemList", 6 * EDSCALE);
theme->set_constant("icon_margin", "ItemList", 6 * EDSCALE);
theme->set_constant("line_separation", "ItemList", 3 * EDSCALE);
@@ -1103,7 +1115,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("decrement_highlight", "TabContainer", theme->get_icon(SNAME("GuiScrollArrowLeftHl"), SNAME("EditorIcons")));
theme->set_icon("drop_mark", "TabContainer", theme->get_icon(SNAME("GuiTabDropMark"), SNAME("EditorIcons")));
theme->set_icon("drop_mark", "TabBar", theme->get_icon(SNAME("GuiTabDropMark"), SNAME("EditorIcons")));
- theme->set_constant("hseparation", "TabBar", 4 * EDSCALE);
+ theme->set_constant("h_separation", "TabBar", 4 * EDSCALE);
// Content of each tab
Ref<StyleBoxFlat> style_content_panel = style_default->duplicate();
@@ -1220,10 +1232,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("breakpoint", "CodeEdit", theme->get_icon(SNAME("Breakpoint"), SNAME("EditorIcons")));
theme->set_constant("line_spacing", "CodeEdit", EDITOR_GET("text_editor/appearance/whitespace/line_spacing"));
- // H/VSplitContainer
- theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon(SNAME("GuiVsplitBg"), SNAME("EditorIcons")), 1, 1, 1, 1));
- theme->set_stylebox("bg", "HSplitContainer", make_stylebox(theme->get_icon(SNAME("GuiHsplitBg"), SNAME("EditorIcons")), 1, 1, 1, 1));
-
theme->set_icon("grabber", "VSplitContainer", theme->get_icon(SNAME("GuiVsplitter"), SNAME("EditorIcons")));
theme->set_icon("grabber", "HSplitContainer", theme->get_icon(SNAME("GuiHsplitter"), SNAME("EditorIcons")));
@@ -1238,14 +1246,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("margin_top", "MarginContainer", 0);
theme->set_constant("margin_right", "MarginContainer", 0);
theme->set_constant("margin_bottom", "MarginContainer", 0);
- theme->set_constant("hseparation", "GridContainer", default_margin_size * EDSCALE);
- theme->set_constant("vseparation", "GridContainer", default_margin_size * EDSCALE);
- theme->set_constant("hseparation", "FlowContainer", default_margin_size * EDSCALE);
- theme->set_constant("vseparation", "FlowContainer", default_margin_size * EDSCALE);
- theme->set_constant("hseparation", "HFlowContainer", default_margin_size * EDSCALE);
- theme->set_constant("vseparation", "HFlowContainer", default_margin_size * EDSCALE);
- theme->set_constant("hseparation", "VFlowContainer", default_margin_size * EDSCALE);
- theme->set_constant("vseparation", "VFlowContainer", default_margin_size * EDSCALE);
+ theme->set_constant("h_separation", "GridContainer", default_margin_size * EDSCALE);
+ theme->set_constant("v_separation", "GridContainer", default_margin_size * EDSCALE);
+ theme->set_constant("h_separation", "FlowContainer", default_margin_size * EDSCALE);
+ theme->set_constant("v_separation", "FlowContainer", default_margin_size * EDSCALE);
+ theme->set_constant("h_separation", "HFlowContainer", default_margin_size * EDSCALE);
+ theme->set_constant("v_separation", "HFlowContainer", default_margin_size * EDSCALE);
+ theme->set_constant("h_separation", "VFlowContainer", default_margin_size * EDSCALE);
+ theme->set_constant("v_separation", "VFlowContainer", default_margin_size * EDSCALE);
// Window
@@ -1265,8 +1273,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("title_color", "Window", font_color);
theme->set_icon("close", "Window", theme->get_icon(SNAME("GuiClose"), SNAME("EditorIcons")));
theme->set_icon("close_pressed", "Window", theme->get_icon(SNAME("GuiClose"), SNAME("EditorIcons")));
- theme->set_constant("close_h_ofs", "Window", 22 * EDSCALE);
- theme->set_constant("close_v_ofs", "Window", 20 * EDSCALE);
+ theme->set_constant("close_h_offset", "Window", 22 * EDSCALE);
+ theme->set_constant("close_v_offset", "Window", 20 * EDSCALE);
theme->set_constant("title_height", "Window", 24 * EDSCALE);
theme->set_constant("resize_margin", "Window", 4 * EDSCALE);
theme->set_font("title_font", "Window", theme->get_font(SNAME("title"), SNAME("EditorFonts")));
@@ -1350,8 +1358,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("code_color", "EditorHelp", accent_color.lerp(mono_color, 0.6));
theme->set_color("kbd_color", "EditorHelp", accent_color.lerp(property_color, 0.6));
theme->set_constant("line_separation", "EditorHelp", Math::round(6 * EDSCALE));
- theme->set_constant("table_hseparation", "EditorHelp", 16 * EDSCALE);
- theme->set_constant("table_vseparation", "EditorHelp", 6 * EDSCALE);
+ theme->set_constant("table_h_separation", "EditorHelp", 16 * EDSCALE);
+ theme->set_constant("table_v_separation", "EditorHelp", 6 * EDSCALE);
// Panel
theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4, corner_width));
@@ -1438,7 +1446,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_minimap_node = make_flat_stylebox(Color(0, 0, 0), 0, 0, 0, 0);
}
style_minimap_camera->set_border_width_all(1);
- style_minimap_node->set_corner_radius_all(1);
theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera);
theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node);
@@ -1453,20 +1460,26 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("resizer_color", "GraphEditMinimap", minimap_resizer_color);
// GraphNode
- const int gn_margin_side = 28;
+ const int gn_margin_side = 2;
+ const int gn_margin_bottom = 2;
+
+ Color graphnode_bg = dark_color_3;
+ if (!dark_theme) {
+ graphnode_bg = prop_section_color;
+ }
- Ref<StyleBoxFlat> graphsb = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), gn_margin_side, 24, gn_margin_side, 5, corner_width);
+ Ref<StyleBoxFlat> graphsb = make_flat_stylebox(graphnode_bg.lerp(style_tree_bg->get_bg_color(), 0.3), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width);
graphsb->set_border_width_all(border_width);
- graphsb->set_border_color(dark_color_3);
- Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.9), gn_margin_side, 24, gn_margin_side, 5, corner_width);
+ graphsb->set_border_color(graphnode_bg);
+ Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 1), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width);
graphsbselected->set_border_width_all(2 * EDSCALE + border_width);
- graphsbselected->set_border_color(Color(accent_color.r, accent_color.g, accent_color.b, 0.9));
- Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.3), gn_margin_side, 24, gn_margin_side, 5, corner_width);
+ graphsbselected->set_border_color(Color(accent_color.r, accent_color.g, accent_color.b, 0.6));
+ Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.3), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width);
graphsbcomment->set_border_width_all(border_width);
- graphsbcomment->set_border_color(dark_color_3);
- Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.4), gn_margin_side, 24, gn_margin_side, 5, corner_width);
+ graphsbcomment->set_border_color(graphnode_bg);
+ Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.4), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width);
graphsbcommentselected->set_border_width_all(border_width);
- graphsbcommentselected->set_border_color(dark_color_3);
+ graphsbcommentselected->set_border_color(graphnode_bg);
Ref<StyleBoxFlat> graphsbbreakpoint = graphsbselected->duplicate();
graphsbbreakpoint->set_draw_center(false);
graphsbbreakpoint->set_border_color(warning_color);
@@ -1475,10 +1488,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
graphsbposition->set_draw_center(false);
graphsbposition->set_border_color(error_color);
graphsbposition->set_shadow_color(error_color * Color(1.0, 1.0, 1.0, 0.2));
- Ref<StyleBoxFlat> smgraphsb = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), gn_margin_side, 24, gn_margin_side, 5, corner_width);
+ Ref<StyleBoxEmpty> graphsbslot = make_empty_stylebox(12, 0, 12, 0);
+ Ref<StyleBoxFlat> smgraphsb = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width);
smgraphsb->set_border_width_all(border_width);
- smgraphsb->set_border_color(dark_color_3);
- Ref<StyleBoxFlat> smgraphsbselected = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.9), gn_margin_side, 24, gn_margin_side, 5, corner_width);
+ smgraphsb->set_border_color(graphnode_bg);
+ Ref<StyleBoxFlat> smgraphsbselected = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.9), gn_margin_side, 24, gn_margin_side, gn_margin_bottom, corner_width);
smgraphsbselected->set_border_width_all(2 * EDSCALE + border_width);
smgraphsbselected->set_border_color(Color(accent_color.r, accent_color.g, accent_color.b, 0.9));
smgraphsbselected->set_shadow_size(8 * EDSCALE);
@@ -1490,24 +1504,25 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
graphsbcommentselected->set_border_width(SIDE_TOP, 24 * EDSCALE);
theme->set_stylebox("frame", "GraphNode", graphsb);
- theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
+ theme->set_stylebox("selected_frame", "GraphNode", graphsbselected);
theme->set_stylebox("comment", "GraphNode", graphsbcomment);
- theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected);
+ theme->set_stylebox("comment_focus", "GraphNode", graphsbcommentselected);
theme->set_stylebox("breakpoint", "GraphNode", graphsbbreakpoint);
theme->set_stylebox("position", "GraphNode", graphsbposition);
+ theme->set_stylebox("slot", "GraphNode", graphsbslot);
theme->set_stylebox("state_machine_frame", "GraphNode", smgraphsb);
- theme->set_stylebox("state_machine_selectedframe", "GraphNode", smgraphsbselected);
-
- Color default_node_color = dark_color_1.inverted();
- theme->set_color("title_color", "GraphNode", default_node_color);
- default_node_color.a = 0.7;
- theme->set_color("close_color", "GraphNode", default_node_color);
- theme->set_color("resizer_color", "GraphNode", default_node_color);
-
- theme->set_constant("port_offset", "GraphNode", 14 * EDSCALE);
- theme->set_constant("title_h_offset", "GraphNode", -16 * EDSCALE);
- theme->set_constant("title_offset", "GraphNode", 20 * EDSCALE);
- theme->set_constant("close_h_offset", "GraphNode", 20 * EDSCALE);
+ theme->set_stylebox("state_machine_selected_frame", "GraphNode", smgraphsbselected);
+
+ Color node_decoration_color = dark_color_1.inverted();
+ theme->set_color("title_color", "GraphNode", node_decoration_color);
+ node_decoration_color.a = 0.7;
+ theme->set_color("close_color", "GraphNode", node_decoration_color);
+ theme->set_color("resizer_color", "GraphNode", node_decoration_color);
+
+ theme->set_constant("port_offset", "GraphNode", 0);
+ theme->set_constant("title_h_offset", "GraphNode", 12 * EDSCALE);
+ theme->set_constant("title_offset", "GraphNode", 21 * EDSCALE);
+ theme->set_constant("close_h_offset", "GraphNode", -2 * EDSCALE);
theme->set_constant("close_offset", "GraphNode", 20 * EDSCALE);
theme->set_constant("separation", "GraphNode", 1 * EDSCALE);
@@ -1515,8 +1530,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("resizer", "GraphNode", theme->get_icon(SNAME("GuiResizer"), SNAME("EditorIcons")));
theme->set_icon("port", "GraphNode", theme->get_icon(SNAME("GuiGraphNodePort"), SNAME("EditorIcons")));
+ theme->set_font("title_font", "GraphNode", theme->get_font(SNAME("main_bold_msdf"), SNAME("EditorFonts")));
+
// GridContainer
- theme->set_constant("vseparation", "GridContainer", Math::round(widget_default_margin.y - 2 * EDSCALE));
+ theme->set_constant("v_separation", "GridContainer", Math::round(widget_default_margin.y - 2 * EDSCALE));
// FileDialog
theme->set_icon("folder", "FileDialog", theme->get_icon(SNAME("Folder"), SNAME("EditorIcons")));