diff options
-rw-r--r-- | editor/create_dialog.cpp | 2 | ||||
-rw-r--r-- | editor/editor_asset_installer.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/editor_plugin_settings.cpp | 8 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 23 | ||||
-rw-r--r-- | editor/export_template_manager.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 16 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 13 | ||||
-rw-r--r-- | editor/project_export.cpp | 4 | ||||
-rw-r--r-- | editor/property_editor.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 4 |
12 files changed, 50 insertions, 36 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index bb5f5e9175..0305013776 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -165,7 +165,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p TreeItem *item = search_options->create_item(parent); item->set_text(0, p_type); if (!ClassDB::can_instance(p_type)) { - item->set_custom_color(0, Color(0.5, 0.5, 0.5)); + item->set_custom_color(0, get_color("disabled_font_color", "Editor")); item->set_selectable(0, false); } else { diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index a8eee24fe2..1aac697ffd 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -197,7 +197,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { String res_path = "res://" + path; if (FileAccess::exists(res_path)) { - ti->set_custom_color(0, Color(1, 0.3, 0.2)); + ti->set_custom_color(0, get_color("error_color", "Editor")); ti->set_tooltip(0, res_path + " (Already Exists)"); ti->set_checked(0, false); } else { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dbee190d7e..3069ba97f2 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3468,7 +3468,7 @@ void EditorNode::_dock_select_draw() { Color used = Color(0.6, 0.6, 0.6, 0.8); Color used_selected = Color(0.8, 0.8, 0.8, 0.8); - Color tab_selected = Color(1, 1, 1, 1); + Color tab_selected = theme_base->get_color("mono_color", "Editor"); Color unused = used; unused.a = 0.4; Color unusable = unused; diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 6732d7048f..8baa56b9b4 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -127,10 +127,10 @@ void EditorPluginSettings::update_plugins() { item->set_editable(3, true); if (EditorNode::get_singleton()->is_addon_plugin_enabled(d)) { - item->set_custom_color(3, Color(0.2, 1, 0.2)); + item->set_custom_color(3, get_color("success_color", "Editor")); item->set_range(3, 1); } else { - item->set_custom_color(3, Color(1, 0.2, 0.2)); + item->set_custom_color(3, get_color("disabled_font_color", "Editor")); item->set_range(3, 0); } } @@ -160,9 +160,9 @@ void EditorPluginSettings::_plugin_activity_changed() { } if (is_active) - ti->set_custom_color(3, Color(0.2, 1, 0.2)); + ti->set_custom_color(3, get_color("success_color", "Editor")); else - ti->set_custom_color(3, Color(1, 0.2, 0.2)); + ti->set_custom_color(3, get_color("disabled_font_color", "Editor")); } void EditorPluginSettings::_bind_methods() { diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index ca337551eb..c38d357cea 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -296,6 +296,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color highlight_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.2); theme->set_color("accent_color", "Editor", accent_color); + theme->set_color("highlight_color", "Editor", highlight_color); theme->set_color("base_color", "Editor", base_color); theme->set_color("dark_color_1", "Editor", dark_color_1); theme->set_color("dark_color_2", "Editor", dark_color_2); @@ -304,17 +305,27 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("contrast_color_2", "Editor", contrast_color_2); theme->set_color("font_color", "Editor", font_color); + theme->set_color("disabled_font_color", "Editor", font_color_disabled); - Color success_color = accent_color.linear_interpolate(Color(.6, 1, .6), 0.8); - Color warning_color = accent_color.linear_interpolate(Color(1, 1, .2), 0.8); - Color error_color = accent_color.linear_interpolate(Color(1, .2, .2), 0.8); + theme->set_color("mono_color", "Editor", mono_color); + + Color success_color = accent_color.linear_interpolate(Color(0.2, 1, 0.2), 0.6) * 1.2; + Color warning_color = accent_color.linear_interpolate(Color(1, 1, 0), 0.7); + Color error_color = accent_color.linear_interpolate(Color(1, 0, 0), 0.8) * 1.7; + if (!dark_theme) { + // yellow on white themes is a P.I.T.A. + warning_color = accent_color.linear_interpolate(Color(1, 0.8, 0), 0.9); + warning_color = warning_color.linear_interpolate(mono_color, 0.2); + success_color = success_color.linear_interpolate(mono_color, 0.2); + error_color = error_color.linear_interpolate(mono_color, 0.2); + } theme->set_color("success_color", "Editor", success_color); theme->set_color("warning_color", "Editor", warning_color); theme->set_color("error_color", "Editor", error_color); // 2d grid color - const Color grid_minor_color = Color(font_color.r, font_color.g, font_color.b, 0.1); - const Color grid_major_color = Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.05); + const Color grid_minor_color = mono_color * Color(1.0, 1.0, 1.0, 0.07); + const Color grid_major_color = Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.15); theme->set_color("grid_major_color", "Editor", grid_major_color); theme->set_color("grid_minor_color", "Editor", grid_minor_color); @@ -693,6 +704,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("focus", "TextEdit", style_widget_hover); theme->set_constant("side_margin", "TabContainer", 0); theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons")); + theme->set_color("font_color", "TextEdit", font_color); + theme->set_color("caret_color", "TextEdit", highlight_color); // H/VSplitContainer theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1)); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 147d5f90c6..d867404f3d 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -73,7 +73,7 @@ void ExportTemplateManager::_update_template_list() { current_hb->add_child(current); if (templates.has(current_version)) { - current->add_color_override("font_color", Color(0.5, 1, 0.5)); + current->add_color_override("font_color", get_color("success_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Re-Download")); current_hb->add_child(redownload); @@ -86,7 +86,7 @@ void ExportTemplateManager::_update_template_list() { uninstall->connect("pressed", this, "_uninstall_template", varray(current_version)); } else { - current->add_color_override("font_color", Color(1.0, 0.5, 0.5)); + current->add_color_override("font_color", get_color("error_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Download")); redownload->connect("pressed", this, "_download_template", varray(current_version)); @@ -98,7 +98,7 @@ void ExportTemplateManager::_update_template_list() { HBoxContainer *hbc = memnew(HBoxContainer); Label *version = memnew(Label); - version->set_modulate(Color(1, 1, 1, 0.7)); + version->set_modulate(get_color("disabled_font_color", "Editor")); String text = E->get(); if (text == current_version) { text += " " + TTR("(Current)"); @@ -299,7 +299,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { void ExportTemplateManager::popup_manager() { _update_template_list(); - popup_centered_minsize(Size2(400, 600) * EDSCALE); + popup_centered_minsize(Size2(400, 400) * EDSCALE); } void ExportTemplateManager::ok_pressed() { diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index db3a303a9b..cd53264437 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -1434,7 +1434,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { error_hb = memnew(HBoxContainer); library_main->add_child(error_hb); error_label = memnew(Label); - error_label->add_color_override("color", Color(1, 0.4, 0.3)); + error_label->add_color_override("color", get_color("error_color", "Editor")); error_hb->add_child(error_label); description = NULL; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 70d771afc8..067629c460 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -613,8 +613,8 @@ void CurveEditor::_draw() { Vector2 min_edge = get_world_pos(Vector2(0, view_size.y)); Vector2 max_edge = get_world_pos(Vector2(view_size.x, 0)); - const Color grid_color0(0, 0, 0, 0.5); - const Color grid_color1(0, 0, 0, 0.15); + const Color grid_color0 = get_color("grid_major_color", "Editor"); + const Color grid_color1 = get_color("grid_minor_color", "Editor"); draw_line(Vector2(min_edge.x, curve.get_min_value()), Vector2(max_edge.x, curve.get_min_value()), grid_color0); draw_line(Vector2(max_edge.x, curve.get_max_value()), Vector2(min_edge.x, curve.get_max_value()), grid_color0); draw_line(Vector2(0, min_edge.y), Vector2(0, max_edge.y), grid_color0); @@ -636,7 +636,7 @@ void CurveEditor::_draw() { Ref<Font> font = get_font("font", "Label"); float font_height = font->get_height(); - const Color text_color(1, 1, 1, 0.3); + const Color text_color = get_color("font_color", "Editor"); { // X axis @@ -664,7 +664,7 @@ void CurveEditor::_draw() { if (_selected_point >= 0) { - const Color tangent_color(0.5, 0.5, 1, 1); + const Color tangent_color = get_color("accent_color", "Editor"); int i = _selected_point; Vector2 pos = curve.get_point_position(i); @@ -686,8 +686,8 @@ void CurveEditor::_draw() { draw_set_transform_matrix(_world_to_view); - const Color line_color(1, 1, 1, 0.85); - const Color edge_line_color(1, 1, 1, 0.4); + const Color line_color = get_color("highlight_color", "Editor"); + const Color edge_line_color = get_color("font_color", "Editor"); CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color); plot_curve_accurate(curve, 4.f / view_size.x, plot_func); @@ -714,8 +714,8 @@ void CurveEditor::_draw() { draw_set_transform_matrix(Transform2D()); - const Color point_color(1, 1, 1); - const Color selected_point_color(1, 0.5, 0.5); + const Color point_color = get_color("font_color", "Editor"); + const Color selected_point_color = get_color("accent_color", "Editor"); for (int i = 0; i < curve.get_point_count(); ++i) { Vector2 pos = curve.get_point_position(i); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 41c2c61d82..3370ce51fd 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -39,7 +39,7 @@ void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) { Vector2 line = (to - from).normalized() * 10; while ((to - from).length_squared() > 200) { - edit_draw->draw_line(from, from + line, Color(0.97, 0.2, 0.2), 2); + edit_draw->draw_line(from, from + line, EditorNode::get_singleton()->get_theme_base()->get_color("mono_color", "Editor"), 2); from += line * 2; } } @@ -66,6 +66,7 @@ void TextureRegionEditor::_region_draw() { VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D()); if (snap_mode == SNAP_GRID) { + Color grid_color = get_color("grid_major_color", "Editor"); Size2 s = edit_draw->get_size(); int last_cell = 0; @@ -76,7 +77,7 @@ void TextureRegionEditor::_region_draw() { if (i == 0) last_cell = cell; if (last_cell != cell) - edit_draw->draw_line(Point2(i, 0), Point2(i, s.height), Color(0.3, 0.7, 1, 0.3)); + edit_draw->draw_line(Point2(i, 0), Point2(i, s.height), grid_color); last_cell = cell; } else @@ -85,7 +86,7 @@ void TextureRegionEditor::_region_draw() { if (i == 0) last_cell = cell; if (last_cell != cell) - edit_draw->draw_rect(Rect2(i - snap_separation.x * draw_zoom, 0, snap_separation.x * draw_zoom, s.height), Color(0.3, 0.7, 1, 0.3)); + edit_draw->draw_rect(Rect2(i - snap_separation.x * draw_zoom, 0, snap_separation.x * draw_zoom, s.height), grid_color); last_cell = cell; } } @@ -97,7 +98,7 @@ void TextureRegionEditor::_region_draw() { if (i == 0) last_cell = cell; if (last_cell != cell) - edit_draw->draw_line(Point2(0, i), Point2(s.width, i), Color(0.3, 0.7, 1, 0.3)); + edit_draw->draw_line(Point2(0, i), Point2(s.width, i), grid_color); last_cell = cell; } else @@ -106,7 +107,7 @@ void TextureRegionEditor::_region_draw() { if (i == 0) last_cell = cell; if (last_cell != cell) - edit_draw->draw_rect(Rect2(0, i - snap_separation.y * draw_zoom, s.width, snap_separation.y * draw_zoom), Color(0.3, 0.7, 1, 0.3)); + edit_draw->draw_rect(Rect2(0, i - snap_separation.y * draw_zoom, s.width, snap_separation.y * draw_zoom), grid_color); last_cell = cell; } } @@ -137,7 +138,7 @@ void TextureRegionEditor::_region_draw() { mtx.basis_xform(rect.position + rect.size), mtx.basis_xform(rect.position + Vector2(0, rect.size.y)) }; - Color color(0.9, 0.5, 0.5); + Color color = get_color("mono_color", "Editor"); for (int i = 0; i < 4; i++) { int prev = (i + 3) % 4; diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 506619a2a7..fafd6805ca 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -929,7 +929,7 @@ ProjectExportDialog::ProjectExportDialog() { export_error = memnew(Label); main_vb->add_child(export_error); export_error->hide(); - export_error->add_color_override("font_color", Color(1, 0.5, 0.5)); + export_error->add_color_override("font_color", get_color("error_color", "Editor")); export_templates_error = memnew(HBoxContainer); main_vb->add_child(export_templates_error); @@ -937,7 +937,7 @@ ProjectExportDialog::ProjectExportDialog() { Label *export_error2 = memnew(Label); export_templates_error->add_child(export_error2); - export_error2->add_color_override("font_color", Color(1, 0.5, 0.5)); + export_error2->add_color_override("font_color", get_color("error_color", "Editor")); export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " "); LinkButton *download_templates = memnew(LinkButton); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index ed90c8c4b2..fcae4c04fb 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2433,7 +2433,7 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction void PropertyEditor::_mark_drop_fields(TreeItem *p_at) { if (_is_drop_valid(get_viewport()->gui_get_drag_data(), p_at->get_metadata(0))) - p_at->set_custom_bg_color(1, Color(0.7, 0.5, 0.2), true); + p_at->set_custom_bg_color(1, get_color("accent_color", "Editor"), true); if (p_at->get_children()) { _mark_drop_fields(p_at->get_children()); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index cfc563f470..6dcd5e54ec 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -185,7 +185,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (part_of_subscene) { //item->set_selectable(0,marked_selectable); - item->set_custom_color(0, get_color("error_color", "Editor").linear_interpolate(get_color("warning_color", "Editor"), 0.4)); + item->set_custom_color(0, get_color("disabled_font_color", "Editor")); } else if (marked.has(p_node)) { @@ -345,7 +345,7 @@ void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) { Color color(1, 1, 1, 1); bool visible_on_screen = p_node->call("is_visible_in_tree"); if (!visible_on_screen) { - color = Color(0.6, 0.6, 0.6, 1); + color.a = 0.6; } int idx = p_item->get_button_by_id(0, BUTTON_VISIBILITY); p_item->set_button_color(0, idx, color); |