diff options
author | volzhs <volzhs@gmail.com> | 2017-12-27 04:41:08 +0900 |
---|---|---|
committer | volzhs <volzhs@gmail.com> | 2017-12-28 23:49:15 +0900 |
commit | 4b0f075e9584b20f23f6f16f29ea078d8bd69650 (patch) | |
tree | f2f9ee2ec7c497e453b48213651d33e61883e9fb | |
parent | edd3bd8cb8a64c1c5bf770c7103809a0ba64a4f0 (diff) |
Respect text editor highlighting color changes
Fix #14838
-rw-r--r-- | editor/editor_settings.cpp | 12 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 95 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 96 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 97 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 2 |
5 files changed, 133 insertions, 169 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 3bd592e934..7450a6f0a9 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -310,7 +310,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("interface/scene_tabs/show_script_button", false); _initial_set("text_editor/theme/color_theme", "Adaptive"); - hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default"); + hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom"); _initial_set("text_editor/theme/line_spacing", 4); @@ -1141,13 +1141,13 @@ void EditorSettings::load_favorites() { } void EditorSettings::list_text_editor_themes() { - String themes = "Adaptive,Default"; + String themes = "Adaptive,Default,Custom"; DirAccess *d = DirAccess::open(get_text_editor_themes_dir()); if (d) { d->list_dir_begin(); String file = d->get_next(); while (file != String()) { - if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default" && file.get_basename().to_lower() != "adaptive") { + if (file.get_extension() == "tet" && file.get_basename().to_lower() != "default" && file.get_basename().to_lower() != "adaptive" && file.get_basename().to_lower() != "custom") { themes += "," + file.get_basename(); } file = d->get_next(); @@ -1159,7 +1159,7 @@ void EditorSettings::list_text_editor_themes() { } void EditorSettings::load_text_editor_theme() { - if (get("text_editor/theme/color_theme") == "Default" || get("text_editor/theme/color_theme") == "Adaptive") { + if (get("text_editor/theme/color_theme") == "Default" || get("text_editor/theme/color_theme") == "Adaptive" || get("text_editor/theme/color_theme") == "Custom") { _load_default_text_editor_theme(); // sorry for "Settings changed" console spam return; } @@ -1216,7 +1216,7 @@ bool EditorSettings::save_text_editor_theme() { String p_file = get("text_editor/theme/color_theme"); - if (p_file.get_file().to_lower() == "default" || p_file.get_file().to_lower() == "adaptive") { + if (p_file.get_file().to_lower() == "default" || p_file.get_file().to_lower() == "adaptive" || p_file.get_file().to_lower() == "custom") { return false; } String theme_path = get_text_editor_themes_dir().plus_file(p_file + ".tet"); @@ -1228,7 +1228,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) { p_file += ".tet"; } - if (p_file.get_file().to_lower() == "default.tet" || p_file.get_file().to_lower() == "adaptive.tet") { + if (p_file.get_file().to_lower() == "default.tet" || p_file.get_file().to_lower() == "adaptive.tet" || p_file.get_file().to_lower() == "custom.tet") { return false; } if (_save_text_editor_theme(p_file)) { diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 5610baa775..4964c78496 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1056,36 +1056,71 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color search_result_color = alpha1; const Color search_result_border_color = alpha4; - theme->set_color("text_editor/theme/symbol_color", "Editor", symbol_color); - theme->set_color("text_editor/theme/keyword_color", "Editor", keyword_color); - theme->set_color("text_editor/theme/basetype_color", "Editor", basetype_color); - theme->set_color("text_editor/theme/type_color", "Editor", type_color); - theme->set_color("text_editor/theme/comment_color", "Editor", comment_color); - theme->set_color("text_editor/theme/string_color", "Editor", string_color); - theme->set_color("text_editor/theme/background_color", "Editor", te_background_color); - theme->set_color("text_editor/theme/completion_background_color", "Editor", completion_background_color); - theme->set_color("text_editor/theme/completion_selected_color", "Editor", completion_selected_color); - theme->set_color("text_editor/theme/completion_existing_color", "Editor", completion_existing_color); - theme->set_color("text_editor/theme/completion_scroll_color", "Editor", completion_scroll_color); - theme->set_color("text_editor/theme/completion_font_color", "Editor", completion_font_color); - theme->set_color("text_editor/theme/text_color", "Editor", text_color); - theme->set_color("text_editor/theme/line_number_color", "Editor", line_number_color); - theme->set_color("text_editor/theme/caret_color", "Editor", caret_color); - theme->set_color("text_editor/theme/caret_background_color", "Editor", caret_background_color); - theme->set_color("text_editor/theme/text_selected_color", "Editor", text_selected_color); - theme->set_color("text_editor/theme/selection_color", "Editor", selection_color); - theme->set_color("text_editor/theme/brace_mismatch_color", "Editor", brace_mismatch_color); - theme->set_color("text_editor/theme/current_line_color", "Editor", current_line_color); - theme->set_color("text_editor/theme/line_length_guideline_color", "Editor", line_length_guideline_color); - theme->set_color("text_editor/theme/word_highlighted_color", "Editor", word_highlighted_color); - theme->set_color("text_editor/theme/number_color", "Editor", number_color); - theme->set_color("text_editor/theme/function_color", "Editor", function_color); - theme->set_color("text_editor/theme/member_variable_color", "Editor", member_variable_color); - theme->set_color("text_editor/theme/mark_color", "Editor", mark_color); - theme->set_color("text_editor/theme/breakpoint_color", "Editor", breakpoint_color); - theme->set_color("text_editor/theme/code_folding_color", "Editor", code_folding_color); - theme->set_color("text_editor/theme/search_result_color", "Editor", search_result_color); - theme->set_color("text_editor/theme/search_result_border_color", "Editor", search_result_border_color); + EditorSettings *setting = EditorSettings::get_singleton(); + String text_editor_color_theme = setting->get("text_editor/theme/color_theme"); + if (text_editor_color_theme == "Adaptive") { + setting->set_manually("text_editor/highlighting/symbol_color", symbol_color); + setting->set_manually("text_editor/highlighting/keyword_color", keyword_color); + setting->set_manually("text_editor/highlighting/base_type_color", basetype_color); + setting->set_manually("text_editor/highlighting/engine_type_color", type_color); + setting->set_manually("text_editor/highlighting/comment_color", comment_color); + setting->set_manually("text_editor/highlighting/string_color", string_color); + setting->set_manually("text_editor/highlighting/background_color", background_color); + setting->set_manually("text_editor/highlighting/completion_background_color", completion_background_color); + setting->set_manually("text_editor/highlighting/completion_selected_color", completion_selected_color); + setting->set_manually("text_editor/highlighting/completion_existing_color", completion_existing_color); + setting->set_manually("text_editor/highlighting/completion_scroll_color", completion_scroll_color); + setting->set_manually("text_editor/highlighting/completion_font_color", completion_font_color); + setting->set_manually("text_editor/highlighting/text_color", text_color); + setting->set_manually("text_editor/highlighting/line_number_color", line_number_color); + setting->set_manually("text_editor/highlighting/caret_color", caret_color); + setting->set_manually("text_editor/highlighting/caret_background_color", caret_background_color); + setting->set_manually("text_editor/highlighting/text_selected_color", text_selected_color); + setting->set_manually("text_editor/highlighting/selection_color", selection_color); + setting->set_manually("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color); + setting->set_manually("text_editor/highlighting/current_line_color", current_line_color); + setting->set_manually("text_editor/highlighting/line_length_guideline_color", line_length_guideline_color); + setting->set_manually("text_editor/highlighting/word_highlighted_color", word_highlighted_color); + setting->set_manually("text_editor/highlighting/number_color", number_color); + setting->set_manually("text_editor/highlighting/function_color", function_color); + setting->set_manually("text_editor/highlighting/member_variable_color", member_variable_color); + setting->set_manually("text_editor/highlighting/mark_color", mark_color); + setting->set_manually("text_editor/highlighting/breakpoint_color", breakpoint_color); + setting->set_manually("text_editor/highlighting/code_folding_color", code_folding_color); + setting->set_manually("text_editor/highlighting/search_result_color", search_result_color); + setting->set_manually("text_editor/highlighting/search_result_border_color", search_result_border_color); + } else if (text_editor_color_theme == "Default") { + setting->set_manually("text_editor/highlighting/symbol_color", Color::html("badfff")); + setting->set_manually("text_editor/highlighting/keyword_color", Color::html("ffffb3")); + setting->set_manually("text_editor/highlighting/base_type_color", Color::html("a4ffd4")); + setting->set_manually("text_editor/highlighting/engine_type_color", Color::html("83d3ff")); + setting->set_manually("text_editor/highlighting/comment_color", Color::html("676767")); + setting->set_manually("text_editor/highlighting/string_color", Color::html("ef6ebe")); + setting->set_manually("text_editor/highlighting/background_color", Color::html("3b000000")); + setting->set_manually("text_editor/highlighting/completion_background_color", Color::html("2C2A32")); + setting->set_manually("text_editor/highlighting/completion_selected_color", Color::html("434244")); + setting->set_manually("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")); + setting->set_manually("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")); + setting->set_manually("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); + setting->set_manually("text_editor/highlighting/text_color", Color::html("aaaaaa")); + setting->set_manually("text_editor/highlighting/line_number_color", Color::html("66aaaaaa")); + setting->set_manually("text_editor/highlighting/caret_color", Color::html("aaaaaa")); + setting->set_manually("text_editor/highlighting/caret_background_color", Color::html("000000")); + setting->set_manually("text_editor/highlighting/text_selected_color", Color::html("000000")); + setting->set_manually("text_editor/highlighting/selection_color", Color::html("6ca9c2")); + setting->set_manually("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); + setting->set_manually("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); + setting->set_manually("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1)); + setting->set_manually("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); + setting->set_manually("text_editor/highlighting/number_color", Color::html("EB9532")); + setting->set_manually("text_editor/highlighting/function_color", Color::html("66a2ce")); + setting->set_manually("text_editor/highlighting/member_variable_color", Color::html("e64e59")); + setting->set_manually("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); + setting->set_manually("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)); + setting->set_manually("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); + setting->set_manually("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); + setting->set_manually("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)); + } return theme; } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 3c9cd74aa1..a59f1a3690 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -75,72 +75,36 @@ void ScriptTextEditor::_load_theme_settings() { text_edit->clear_colors(); - Color background_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0)); - Color completion_background_color = EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0)); - Color completion_selected_color = EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244")); - Color completion_existing_color = EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")); - Color completion_scroll_color = EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")); - Color completion_font_color = EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); - Color text_color = EDITOR_DEF("text_editor/highlighting/text_color", Color(0, 0, 0)); - Color line_number_color = EDITOR_DEF("text_editor/highlighting/line_number_color", Color(0, 0, 0)); - Color caret_color = EDITOR_DEF("text_editor/highlighting/caret_color", Color(0, 0, 0)); - Color caret_background_color = EDITOR_DEF("text_editor/highlighting/caret_background_color", Color(0, 0, 0)); - Color text_selected_color = EDITOR_DEF("text_editor/highlighting/text_selected_color", Color(1, 1, 1)); - Color selection_color = EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)); - Color brace_mismatch_color = EDITOR_DEF("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); - Color current_line_color = EDITOR_DEF("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); - Color line_length_guideline_color = EDITOR_DEF("text_editor/highlighting/line_length_guideline_color", Color(0, 0, 0)); - Color word_highlighted_color = EDITOR_DEF("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); - Color number_color = EDITOR_DEF("text_editor/highlighting/number_color", Color(0.9, 0.6, 0.0, 2)); - Color function_color = EDITOR_DEF("text_editor/highlighting/function_color", Color(0.4, 0.6, 0.8)); - Color member_variable_color = EDITOR_DEF("text_editor/highlighting/member_variable_color", Color(0.9, 0.3, 0.3)); - Color mark_color = EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); - Color breakpoint_color = EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)); - Color code_folding_color = EDITOR_DEF("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); - Color search_result_color = EDITOR_DEF("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); - Color search_result_border_color = EDITOR_DEF("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)); - Color symbol_color = EDITOR_DEF("text_editor/highlighting/symbol_color", Color::hex(0x005291ff)); - Color keyword_color = EDITOR_DEF("text_editor/highlighting/keyword_color", Color(0.5, 0.0, 0.2)); - Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0)); - Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4)); - Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color", Color::hex(0x797e7eff)); - Color string_color = EDITOR_DEF("text_editor/highlighting/string_color", Color::hex(0x6b6f00ff)); - - // Adapt - if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") { - Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme(); - - symbol_color = tm->get_color("text_editor/theme/symbol_color", "Editor"); - keyword_color = tm->get_color("text_editor/theme/keyword_color", "Editor"); - basetype_color = tm->get_color("text_editor/theme/basetype_color", "Editor"); - type_color = tm->get_color("text_editor/theme/type_color", "Editor"); - comment_color = tm->get_color("text_editor/theme/comment_color", "Editor"); - string_color = tm->get_color("text_editor/theme/string_color", "Editor"); - background_color = tm->get_color("text_editor/theme/background_color", "Editor"); - completion_background_color = tm->get_color("text_editor/theme/completion_background_color", "Editor"); - completion_selected_color = tm->get_color("text_editor/theme/completion_selected_color", "Editor"); - completion_existing_color = tm->get_color("text_editor/theme/completion_existing_color", "Editor"); - completion_scroll_color = tm->get_color("text_editor/theme/completion_scroll_color", "Editor"); - completion_font_color = tm->get_color("text_editor/theme/completion_font_color", "Editor"); - text_color = tm->get_color("text_editor/theme/text_color", "Editor"); - line_number_color = tm->get_color("text_editor/theme/line_number_color", "Editor"); - caret_color = tm->get_color("text_editor/theme/caret_color", "Editor"); - caret_background_color = tm->get_color("text_editor/theme/caret_background_color", "Editor"); - text_selected_color = tm->get_color("text_editor/theme/text_selected_color", "Editor"); - selection_color = tm->get_color("text_editor/theme/selection_color", "Editor"); - brace_mismatch_color = tm->get_color("text_editor/theme/brace_mismatch_color", "Editor"); - current_line_color = tm->get_color("text_editor/theme/current_line_color", "Editor"); - line_length_guideline_color = tm->get_color("text_editor/theme/line_length_guideline_color", "Editor"); - word_highlighted_color = tm->get_color("text_editor/theme/word_highlighted_color", "Editor"); - number_color = tm->get_color("text_editor/theme/number_color", "Editor"); - function_color = tm->get_color("text_editor/theme/function_color", "Editor"); - member_variable_color = tm->get_color("text_editor/theme/member_variable_color", "Editor"); - mark_color = tm->get_color("text_editor/theme/mark_color", "Editor"); - breakpoint_color = tm->get_color("text_editor/theme/breakpoint_color", "Editor"); - code_folding_color = tm->get_color("text_editor/theme/code_folding_color", "Editor"); - search_result_color = tm->get_color("text_editor/theme/search_result_color", "Editor"); - search_result_border_color = tm->get_color("text_editor/theme/search_result_border_color", "Editor"); - } + Color background_color = EDITOR_GET("text_editor/highlighting/background_color"); + Color completion_background_color = EDITOR_GET("text_editor/highlighting/completion_background_color"); + Color completion_selected_color = EDITOR_GET("text_editor/highlighting/completion_selected_color"); + Color completion_existing_color = EDITOR_GET("text_editor/highlighting/completion_existing_color"); + Color completion_scroll_color = EDITOR_GET("text_editor/highlighting/completion_scroll_color"); + Color completion_font_color = EDITOR_GET("text_editor/highlighting/completion_font_color"); + Color text_color = EDITOR_GET("text_editor/highlighting/text_color"); + Color line_number_color = EDITOR_GET("text_editor/highlighting/line_number_color"); + Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color"); + Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color"); + Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color"); + Color selection_color = EDITOR_GET("text_editor/highlighting/selection_color"); + Color brace_mismatch_color = EDITOR_GET("text_editor/highlighting/brace_mismatch_color"); + Color current_line_color = EDITOR_GET("text_editor/highlighting/current_line_color"); + Color line_length_guideline_color = EDITOR_GET("text_editor/highlighting/line_length_guideline_color"); + Color word_highlighted_color = EDITOR_GET("text_editor/highlighting/word_highlighted_color"); + Color number_color = EDITOR_GET("text_editor/highlighting/number_color"); + Color function_color = EDITOR_GET("text_editor/highlighting/function_color"); + Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color"); + Color mark_color = EDITOR_GET("text_editor/highlighting/mark_color"); + Color breakpoint_color = EDITOR_GET("text_editor/highlighting/breakpoint_color"); + Color code_folding_color = EDITOR_GET("text_editor/highlighting/code_folding_color"); + Color search_result_color = EDITOR_GET("text_editor/highlighting/search_result_color"); + Color search_result_border_color = EDITOR_GET("text_editor/highlighting/search_result_border_color"); + Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color"); + Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color"); + Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color"); + Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); + Color string_color = EDITOR_GET("text_editor/highlighting/string_color"); text_edit->add_color_override("background_color", background_color); text_edit->add_color_override("completion_background_color", completion_background_color); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index d0b0d3690a..aa0607dfc0 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -60,73 +60,36 @@ void ShaderTextEditor::_load_theme_settings() { get_text_edit()->clear_colors(); - Color background_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0)); - Color completion_background_color = EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0, 0, 0, 0)); - Color completion_selected_color = EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244")); - Color completion_existing_color = EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")); - Color completion_scroll_color = EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")); - Color completion_font_color = EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); - Color text_color = EDITOR_DEF("text_editor/highlighting/text_color", Color(0, 0, 0)); - Color line_number_color = EDITOR_DEF("text_editor/highlighting/line_number_color", Color(0, 0, 0)); - Color caret_color = EDITOR_DEF("text_editor/highlighting/caret_color", Color(0, 0, 0)); - Color caret_background_color = EDITOR_DEF("text_editor/highlighting/caret_background_color", Color(0, 0, 0)); - Color text_selected_color = EDITOR_DEF("text_editor/highlighting/text_selected_color", Color(1, 1, 1)); - Color selection_color = EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1)); - Color brace_mismatch_color = EDITOR_DEF("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2)); - Color current_line_color = EDITOR_DEF("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15)); - Color line_length_guideline_color = EDITOR_DEF("text_editor/highlighting/line_length_guideline_color", Color(0, 0, 0)); - Color word_highlighted_color = EDITOR_DEF("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15)); - Color number_color = EDITOR_DEF("text_editor/highlighting/number_color", Color(0.9, 0.6, 0.0, 2)); - Color function_color = EDITOR_DEF("text_editor/highlighting/function_color", Color(0.4, 0.6, 0.8)); - Color member_variable_color = EDITOR_DEF("text_editor/highlighting/member_variable_color", Color(0.9, 0.3, 0.3)); - Color mark_color = EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4)); - Color breakpoint_color = EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2)); - Color code_folding_color = EDITOR_DEF("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8)); - Color search_result_color = EDITOR_DEF("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1)); - Color search_result_border_color = EDITOR_DEF("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1)); - Color symbol_color = EDITOR_DEF("text_editor/highlighting/symbol_color", Color::hex(0x005291ff)); - - Color keyword_color = EDITOR_DEF("text_editor/highlighting/keyword_color", Color(0.5, 0.0, 0.2)); - Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0)); - Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4)); - Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color", Color::hex(0x797e7eff)); - Color string_color = EDITOR_DEF("text_editor/highlighting/string_color", Color::hex(0x6b6f00ff)); - - // Adapt - if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") { - Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme(); - - symbol_color = tm->get_color("text_editor/theme/symbol_color", "Editor"); - keyword_color = tm->get_color("text_editor/theme/keyword_color", "Editor"); - basetype_color = tm->get_color("text_editor/theme/basetype_color", "Editor"); - type_color = tm->get_color("text_editor/theme/type_color", "Editor"); - comment_color = tm->get_color("text_editor/theme/comment_color", "Editor"); - string_color = tm->get_color("text_editor/theme/string_color", "Editor"); - background_color = tm->get_color("text_editor/theme/background_color", "Editor"); - completion_background_color = tm->get_color("text_editor/theme/completion_background_color", "Editor"); - completion_selected_color = tm->get_color("text_editor/theme/completion_selected_color", "Editor"); - completion_existing_color = tm->get_color("text_editor/theme/completion_existing_color", "Editor"); - completion_scroll_color = tm->get_color("text_editor/theme/completion_scroll_color", "Editor"); - completion_font_color = tm->get_color("text_editor/theme/completion_font_color", "Editor"); - text_color = tm->get_color("text_editor/theme/text_color", "Editor"); - line_number_color = tm->get_color("text_editor/theme/line_number_color", "Editor"); - caret_color = tm->get_color("text_editor/theme/caret_color", "Editor"); - caret_background_color = tm->get_color("text_editor/theme/caret_background_color", "Editor"); - text_selected_color = tm->get_color("text_editor/theme/text_selected_color", "Editor"); - selection_color = tm->get_color("text_editor/theme/selection_color", "Editor"); - brace_mismatch_color = tm->get_color("text_editor/theme/brace_mismatch_color", "Editor"); - current_line_color = tm->get_color("text_editor/theme/current_line_color", "Editor"); - line_length_guideline_color = tm->get_color("text_editor/theme/line_length_guideline_color", "Editor"); - word_highlighted_color = tm->get_color("text_editor/theme/word_highlighted_color", "Editor"); - number_color = tm->get_color("text_editor/theme/number_color", "Editor"); - function_color = tm->get_color("text_editor/theme/function_color", "Editor"); - member_variable_color = tm->get_color("text_editor/theme/member_variable_color", "Editor"); - mark_color = tm->get_color("text_editor/theme/mark_color", "Editor"); - breakpoint_color = tm->get_color("text_editor/theme/breakpoint_color", "Editor"); - code_folding_color = tm->get_color("text_editor/theme/code_folding_color", "Editor"); - search_result_color = tm->get_color("text_editor/theme/search_result_color", "Editor"); - search_result_border_color = tm->get_color("text_editor/theme/search_result_border_color", "Editor"); - } + Color background_color = EDITOR_GET("text_editor/highlighting/background_color"); + Color completion_background_color = EDITOR_GET("text_editor/highlighting/completion_background_color"); + Color completion_selected_color = EDITOR_GET("text_editor/highlighting/completion_selected_color"); + Color completion_existing_color = EDITOR_GET("text_editor/highlighting/completion_existing_color"); + Color completion_scroll_color = EDITOR_GET("text_editor/highlighting/completion_scroll_color"); + Color completion_font_color = EDITOR_GET("text_editor/highlighting/completion_font_color"); + Color text_color = EDITOR_GET("text_editor/highlighting/text_color"); + Color line_number_color = EDITOR_GET("text_editor/highlighting/line_number_color"); + Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color"); + Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color"); + Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color"); + Color selection_color = EDITOR_GET("text_editor/highlighting/selection_color"); + Color brace_mismatch_color = EDITOR_GET("text_editor/highlighting/brace_mismatch_color"); + Color current_line_color = EDITOR_GET("text_editor/highlighting/current_line_color"); + Color line_length_guideline_color = EDITOR_GET("text_editor/highlighting/line_length_guideline_color"); + Color word_highlighted_color = EDITOR_GET("text_editor/highlighting/word_highlighted_color"); + Color number_color = EDITOR_GET("text_editor/highlighting/number_color"); + Color function_color = EDITOR_GET("text_editor/highlighting/function_color"); + Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color"); + Color mark_color = EDITOR_GET("text_editor/highlighting/mark_color"); + Color breakpoint_color = EDITOR_GET("text_editor/highlighting/breakpoint_color"); + Color code_folding_color = EDITOR_GET("text_editor/highlighting/code_folding_color"); + Color search_result_color = EDITOR_GET("text_editor/highlighting/search_result_color"); + Color search_result_border_color = EDITOR_GET("text_editor/highlighting/search_result_border_color"); + Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color"); + Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color"); + Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color"); + Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); + Color string_color = EDITOR_GET("text_editor/highlighting/string_color"); get_text_edit()->add_color_override("background_color", background_color); get_text_edit()->add_color_override("completion_background_color", completion_background_color); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 2bdc824248..345f647608 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -61,6 +61,8 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) { property_editor->get_property_editor()->update_tree(); } else if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") { EditorSettings::get_singleton()->set_manually("interface/theme/preset", 6); // set preset to Custom + } else if (full_name.begins_with("text_editor/highlighting")) { + EditorSettings::get_singleton()->set_manually("text_editor/theme/color_theme", "Custom"); } } |