From 60b70c77e05ac75f25af110c107cc5d97c35fa89 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 23 Mar 2019 01:57:28 +0100 Subject: Improve the editor theme The editor theme now makes use of rounded corners and less borders to follow modern visual trends. The default theme's colors were also tweaked to make the blue hue more subtle (similar to the Arc theme, which was removed as a consequence). The Alien theme was replaced by a Breeze Dark theme, which should blend in well with the KDE theme. --- modules/visual_script/visual_script_editor.cpp | 56 ++++++++++---------------- modules/visual_script/visual_script_editor.h | 1 + 2 files changed, 23 insertions(+), 34 deletions(-) (limited to 'modules/visual_script') diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 02ec9ccd06..64c4ef1513 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -740,21 +740,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Color c = sbf->get_border_color(); Color ic = c; - c.a = 1; - if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { - Color mono_color; - if (((c.r + c.g + c.b) / 3) < 0.7) { - mono_color = Color(1.0, 1.0, 1.0); - ic = Color(0.0, 0.0, 0.0, 0.7); - } else { - mono_color = Color(0.0, 0.0, 0.0); - ic = Color(1.0, 1.0, 1.0, 0.7); - } - mono_color.a = 0.85; - c = mono_color; - } gnode->add_theme_color_override("title_color", c); - c.a = 0.7; + c.a = 1; gnode->add_theme_color_override("close_color", c); gnode->add_theme_color_override("resizer_color", ic); gnode->add_theme_style_override("frame", sbf); @@ -3623,32 +3610,33 @@ void VisualScriptEditor::_notification(int p_what) { bool dark_theme = tm->get_constant("dark_theme", "Editor"); - List> colors; if (dark_theme) { - colors.push_back(Pair("flow_control", Color(0.96, 0.96, 0.96))); - colors.push_back(Pair("functions", Color(0.96, 0.52, 0.51))); - colors.push_back(Pair("data", Color(0.5, 0.96, 0.81))); - colors.push_back(Pair("operators", Color(0.67, 0.59, 0.87))); - colors.push_back(Pair("custom", Color(0.5, 0.73, 0.96))); - colors.push_back(Pair("constants", Color(0.96, 0.5, 0.69))); + node_colors["flow_control"] = Color(0.96, 0.96, 0.96); + node_colors["functions"] = Color(0.96, 0.52, 0.51); + node_colors["data"] = Color(0.5, 0.96, 0.81); + node_colors["operators"] = Color(0.67, 0.59, 0.87); + node_colors["custom"] = Color(0.5, 0.73, 0.96); + node_colors["constants"] = Color(0.96, 0.5, 0.69); } else { - colors.push_back(Pair("flow_control", Color(0.26, 0.26, 0.26))); - colors.push_back(Pair("functions", Color(0.95, 0.4, 0.38))); - colors.push_back(Pair("data", Color(0.07, 0.73, 0.51))); - colors.push_back(Pair("operators", Color(0.51, 0.4, 0.82))); - colors.push_back(Pair("custom", Color(0.31, 0.63, 0.95))); - colors.push_back(Pair("constants", Color(0.94, 0.18, 0.49))); + node_colors["flow_control"] = Color(0.26, 0.26, 0.26); + node_colors["functions"] = Color(0.95, 0.4, 0.38); + node_colors["data"] = Color(0.07, 0.73, 0.51); + node_colors["operators"] = Color(0.51, 0.4, 0.82); + node_colors["custom"] = Color(0.31, 0.63, 0.95); + node_colors["constants"] = Color(0.94, 0.18, 0.49); } - for (List>::Element *E = colors.front(); E; E = E->next()) { - Ref sb = tm->get_stylebox("frame", "GraphNode"); + for (Map::Element *E = node_colors.front(); E; E = E->next()) { + const Ref sb = tm->get_stylebox("frame", "GraphNode"); + if (!sb.is_null()) { Ref frame_style = sb->duplicate(); - Color c = sb->get_border_color(); - Color cn = E->get().second; - cn.a = c.a; - frame_style->set_border_color(cn); - node_styles[E->get().first] = frame_style; + // Adjust the border color to be close to the GraphNode's background color. + // This keeps the node's title area from being too distracting. + Color color = dark_theme ? E->get().darkened(0.75) : E->get().lightened(0.75); + color.a = 0.9; + frame_style->set_border_color(color); + node_styles[E->key()] = frame_style; } } diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index bb6f194286..fc9a2df60f 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -135,6 +135,7 @@ class VisualScriptEditor : public ScriptEditorBase { Vector> args; }; + Map node_colors; HashMap> node_styles; void _update_graph_connections(); -- cgit v1.2.3