|
@@ -695,45 +695,47 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|
|
EDITOR_SETTING_BASIC(Variant::STRING, PROPERTY_HINT_ENUM, "text_editor/theme/color_theme", "Default", "Default,Godot 2,Custom")
|
|
|
|
|
|
// Theme: Highlighting
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/symbol_color", Color(0.73, 0.87, 1.0), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/keyword_color", Color(1.0, 1.0, 0.7), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/control_flow_keyword_color", Color(1.0, 0.85, 0.7), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/base_type_color", Color(0.64, 1.0, 0.83), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/engine_type_color", Color(0.51, 0.83, 1.0), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/user_type_color", Color(0.42, 0.67, 0.93), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/comment_color", Color(0.4, 0.4, 0.4), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/doc_comment_color", Color(0.5, 0.6, 0.7), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/string_color", Color(0.94, 0.43, 0.75), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/background_color", Color(0.13, 0.12, 0.15), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/completion_background_color", Color(0.17, 0.16, 0.2), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/completion_existing_color", Color(0.87, 0.87, 0.87, 0.13), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/completion_scroll_color", Color(1, 1, 1, 0.29), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/completion_scroll_hovered_color", Color(1, 1, 1, 0.4), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/completion_font_color", Color(0.67, 0.67, 0.67), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/text_color", Color(0.67, 0.67, 0.67), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/caret_color", Color(0.67, 0.67, 0.67), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/caret_background_color", Color(0, 0, 0), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/text_selected_color", Color(0, 0, 0, 0), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/number_color", Color(0.92, 0.58, 0.2), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/function_color", Color(0.4, 0.64, 0.81), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/member_variable_color", Color(0.9, 0.31, 0.35), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4), "")
|
|
|
- EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/warning_color", Color(1.0, 0.8, 0.4, 0.1), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/bookmark_color", Color(0.08, 0.49, 0.98), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/breakpoint_color", Color(0.9, 0.29, 0.3), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/executing_line_color", Color(0.98, 0.89, 0.27), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/folded_code_region_color", Color(0.68, 0.46, 0.77, 0.2), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1), "")
|
|
|
- EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "text_editor/theme/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38), "")
|
|
|
+ const LocalVector<StringName> basic_text_editor_settings = {
|
|
|
+ "text_editor/theme/highlighting/symbol_color",
|
|
|
+ "text_editor/theme/highlighting/keyword_color",
|
|
|
+ "text_editor/theme/highlighting/control_flow_keyword_color",
|
|
|
+ "text_editor/theme/highlighting/base_type_color",
|
|
|
+ "text_editor/theme/highlighting/engine_type_color",
|
|
|
+ "text_editor/theme/highlighting/user_type_color",
|
|
|
+ "text_editor/theme/highlighting/comment_color",
|
|
|
+ "text_editor/theme/highlighting/doc_comment_color",
|
|
|
+ "text_editor/theme/highlighting/string_color",
|
|
|
+ "text_editor/theme/highlighting/background_color",
|
|
|
+ "text_editor/theme/highlighting/text_color",
|
|
|
+ "text_editor/theme/highlighting/line_number_color",
|
|
|
+ "text_editor/theme/highlighting/safe_line_number_color",
|
|
|
+ "text_editor/theme/highlighting/caret_color",
|
|
|
+ "text_editor/theme/highlighting/caret_background_color",
|
|
|
+ "text_editor/theme/highlighting/text_selected_color",
|
|
|
+ "text_editor/theme/highlighting/selection_color",
|
|
|
+ "text_editor/theme/highlighting/brace_mismatch_color",
|
|
|
+ "text_editor/theme/highlighting/current_line_color",
|
|
|
+ "text_editor/theme/highlighting/line_length_guideline_color",
|
|
|
+ "text_editor/theme/highlighting/word_highlighted_color",
|
|
|
+ "text_editor/theme/highlighting/number_color",
|
|
|
+ "text_editor/theme/highlighting/function_color",
|
|
|
+ "text_editor/theme/highlighting/member_variable_color",
|
|
|
+ "text_editor/theme/highlighting/mark_color",
|
|
|
+ };
|
|
|
+ // These values will be overwritten by EditorThemeManager, but can still be seen in some edge cases.
|
|
|
+ const HashMap<StringName, Color> text_colors = get_godot2_text_editor_theme();
|
|
|
+ for (const KeyValue<StringName, Color> &text_color : text_colors) {
|
|
|
+ if (basic_text_editor_settings.has(text_color.key)) {
|
|
|
+ EDITOR_SETTING_BASIC(Variant::COLOR, PROPERTY_HINT_NONE, text_color.key, text_color.value, "")
|
|
|
+ } else {
|
|
|
+ EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, text_color.key, text_color.value, "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // The list is based on <https://github.com/KDE/syntax-highlighting/blob/master/data/syntax/alert.xml>.
|
|
|
+ _initial_set("text_editor/theme/highlighting/comment_markers/critical_list", "ALERT,ATTENTION,CAUTION,CRITICAL,DANGER,SECURITY");
|
|
|
+ _initial_set("text_editor/theme/highlighting/comment_markers/warning_list", "BUG,DEPRECATED,FIXME,HACK,TASK,TBD,TODO,WARNING");
|
|
|
+ _initial_set("text_editor/theme/highlighting/comment_markers/notice_list", "INFO,NOTE,NOTICE,TEST,TESTING");
|
|
|
|
|
|
// Appearance
|
|
|
EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "text_editor/appearance/enable_inline_color_picker", true, "");
|
|
@@ -1140,49 +1142,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void EditorSettings::_load_godot2_text_editor_theme() {
|
|
|
- // Godot 2 is only a dark theme; it doesn't have a light theme counterpart.
|
|
|
- _initial_set("text_editor/theme/highlighting/symbol_color", Color(0.73, 0.87, 1.0), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/keyword_color", Color(1.0, 1.0, 0.7), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/control_flow_keyword_color", Color(1.0, 0.85, 0.7), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/base_type_color", Color(0.64, 1.0, 0.83), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/engine_type_color", Color(0.51, 0.83, 1.0), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/user_type_color", Color(0.42, 0.67, 0.93), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/comment_color", Color(0.4, 0.4, 0.4), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/doc_comment_color", Color(0.5, 0.6, 0.7), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/string_color", Color(0.94, 0.43, 0.75), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/background_color", Color(0.13, 0.12, 0.15), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/completion_background_color", Color(0.17, 0.16, 0.2));
|
|
|
- _initial_set("text_editor/theme/highlighting/completion_selected_color", Color(0.26, 0.26, 0.27));
|
|
|
- _initial_set("text_editor/theme/highlighting/completion_existing_color", Color(0.87, 0.87, 0.87, 0.13));
|
|
|
- _initial_set("text_editor/theme/highlighting/completion_scroll_color", Color(1, 1, 1, 0.29));
|
|
|
- _initial_set("text_editor/theme/highlighting/completion_scroll_hovered_color", Color(1, 1, 1, 0.4));
|
|
|
- _initial_set("text_editor/theme/highlighting/completion_font_color", Color(0.67, 0.67, 0.67));
|
|
|
- _initial_set("text_editor/theme/highlighting/text_color", Color(0.67, 0.67, 0.67), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/line_number_color", Color(0.67, 0.67, 0.67, 0.4), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/safe_line_number_color", Color(0.67, 0.78, 0.67, 0.6), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/caret_color", Color(0.67, 0.67, 0.67), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/caret_background_color", Color(0, 0, 0), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/text_selected_color", Color(0, 0, 0, 0), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/selection_color", Color(0.41, 0.61, 0.91, 0.35), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/number_color", Color(0.92, 0.58, 0.2), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/function_color", Color(0.4, 0.64, 0.81), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/member_variable_color", Color(0.9, 0.31, 0.35), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/warning_color", Color(1.0, 0.8, 0.4, 0.1), true);
|
|
|
- _initial_set("text_editor/theme/highlighting/bookmark_color", Color(0.08, 0.49, 0.98));
|
|
|
- _initial_set("text_editor/theme/highlighting/breakpoint_color", Color(0.9, 0.29, 0.3));
|
|
|
- _initial_set("text_editor/theme/highlighting/executing_line_color", Color(0.98, 0.89, 0.27));
|
|
|
- _initial_set("text_editor/theme/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8));
|
|
|
- _initial_set("text_editor/theme/highlighting/folded_code_region_color", Color(0.68, 0.46, 0.77, 0.2));
|
|
|
- _initial_set("text_editor/theme/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
|
|
|
- _initial_set("text_editor/theme/highlighting/search_result_border_color", Color(0.41, 0.61, 0.91, 0.38));
|
|
|
-}
|
|
|
-
|
|
|
void EditorSettings::_load_default_visual_shader_editor_theme() {
|
|
|
// Connection type colors
|
|
|
_initial_set("editors/visual_editors/connection_colors/scalar_color", Color(0.55, 0.55, 0.55));
|
|
@@ -1241,33 +1200,6 @@ String EditorSettings::_guess_exec_args_for_extenal_editor(const String &p_path)
|
|
|
return new_exec_flags;
|
|
|
}
|
|
|
|
|
|
-bool EditorSettings::_save_text_editor_theme(const String &p_file) {
|
|
|
- String theme_section = "color_theme";
|
|
|
- Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better?
|
|
|
-
|
|
|
- List<String> keys;
|
|
|
-
|
|
|
- for (const KeyValue<String, VariantContainer> &E : props) {
|
|
|
- keys.push_back(E.key);
|
|
|
- }
|
|
|
-
|
|
|
- keys.sort();
|
|
|
-
|
|
|
- for (const String &key : keys) {
|
|
|
- if (key.begins_with("text_editor/theme/highlighting/") && key.contains("color")) {
|
|
|
- cf->set_value(theme_section, key.replace("text_editor/theme/highlighting/", ""), ((Color)props[key].variant).to_html());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Error err = cf->save(p_file);
|
|
|
-
|
|
|
- return err == OK;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorSettings::_is_default_text_editor_theme(const String &p_theme_name) {
|
|
|
- return p_theme_name == "default" || p_theme_name == "godot 2" || p_theme_name == "custom";
|
|
|
-}
|
|
|
-
|
|
|
const String EditorSettings::_get_project_metadata_path() const {
|
|
|
return EditorPaths::get_singleton()->get_project_settings_dir().path_join("project_metadata.cfg");
|
|
|
}
|
|
@@ -1360,7 +1292,7 @@ void EditorSettings::create() {
|
|
|
singleton->setup_language();
|
|
|
singleton->setup_network();
|
|
|
singleton->load_favorites_and_recent_dirs();
|
|
|
- singleton->list_text_editor_themes();
|
|
|
+ singleton->update_text_editor_themes_list();
|
|
|
#ifndef DISABLE_DEPRECATED
|
|
|
singleton->_remove_deprecated_settings();
|
|
|
#endif
|
|
@@ -1386,7 +1318,7 @@ fail:
|
|
|
singleton->_load_defaults(extra_config);
|
|
|
singleton->setup_language();
|
|
|
singleton->setup_network();
|
|
|
- singleton->list_text_editor_themes();
|
|
|
+ singleton->update_text_editor_themes_list();
|
|
|
}
|
|
|
|
|
|
void EditorSettings::setup_language() {
|
|
@@ -1748,118 +1680,89 @@ void EditorSettings::load_favorites_and_recent_dirs() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void EditorSettings::list_text_editor_themes() {
|
|
|
- String themes = "Default,Godot 2,Custom";
|
|
|
-
|
|
|
- Ref<DirAccess> d = DirAccess::open(EditorPaths::get_singleton()->get_text_editor_themes_dir());
|
|
|
- if (d.is_valid()) {
|
|
|
- List<String> custom_themes;
|
|
|
- d->list_dir_begin();
|
|
|
- String file = d->get_next();
|
|
|
- while (!file.is_empty()) {
|
|
|
- if (file.get_extension() == "tet" && !_is_default_text_editor_theme(file.get_basename().to_lower())) {
|
|
|
- custom_themes.push_back(file.get_basename());
|
|
|
- }
|
|
|
- file = d->get_next();
|
|
|
- }
|
|
|
- d->list_dir_end();
|
|
|
-
|
|
|
- custom_themes.sort();
|
|
|
- for (const String &E : custom_themes) {
|
|
|
- themes += "," + E;
|
|
|
- }
|
|
|
- }
|
|
|
- add_property_hint(PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, themes));
|
|
|
+HashMap<StringName, Color> EditorSettings::get_godot2_text_editor_theme() {
|
|
|
+ // Godot 2 is only a dark theme; it doesn't have a light theme counterpart.
|
|
|
+ HashMap<StringName, Color> colors;
|
|
|
+ colors["text_editor/theme/highlighting/symbol_color"] = Color(0.73, 0.87, 1.0);
|
|
|
+ colors["text_editor/theme/highlighting/keyword_color"] = Color(1.0, 1.0, 0.7);
|
|
|
+ colors["text_editor/theme/highlighting/control_flow_keyword_color"] = Color(1.0, 0.85, 0.7);
|
|
|
+ colors["text_editor/theme/highlighting/base_type_color"] = Color(0.64, 1.0, 0.83);
|
|
|
+ colors["text_editor/theme/highlighting/engine_type_color"] = Color(0.51, 0.83, 1.0);
|
|
|
+ colors["text_editor/theme/highlighting/user_type_color"] = Color(0.42, 0.67, 0.93);
|
|
|
+ colors["text_editor/theme/highlighting/comment_color"] = Color(0.4, 0.4, 0.4);
|
|
|
+ colors["text_editor/theme/highlighting/doc_comment_color"] = Color(0.5, 0.6, 0.7);
|
|
|
+ colors["text_editor/theme/highlighting/string_color"] = Color(0.94, 0.43, 0.75);
|
|
|
+ colors["text_editor/theme/highlighting/background_color"] = Color(0.13, 0.12, 0.15);
|
|
|
+ colors["text_editor/theme/highlighting/completion_background_color"] = Color(0.17, 0.16, 0.2);
|
|
|
+ colors["text_editor/theme/highlighting/completion_selected_color"] = Color(0.26, 0.26, 0.27);
|
|
|
+ colors["text_editor/theme/highlighting/completion_existing_color"] = Color(0.87, 0.87, 0.87, 0.13);
|
|
|
+ colors["text_editor/theme/highlighting/completion_scroll_color"] = Color(1, 1, 1, 0.29);
|
|
|
+ colors["text_editor/theme/highlighting/completion_scroll_hovered_color"] = Color(1, 1, 1, 0.4);
|
|
|
+ colors["text_editor/theme/highlighting/completion_font_color"] = Color(0.67, 0.67, 0.67);
|
|
|
+ colors["text_editor/theme/highlighting/text_color"] = Color(0.67, 0.67, 0.67);
|
|
|
+ colors["text_editor/theme/highlighting/line_number_color"] = Color(0.67, 0.67, 0.67, 0.4);
|
|
|
+ colors["text_editor/theme/highlighting/safe_line_number_color"] = Color(0.67, 0.78, 0.67, 0.6);
|
|
|
+ colors["text_editor/theme/highlighting/caret_color"] = Color(0.67, 0.67, 0.67);
|
|
|
+ colors["text_editor/theme/highlighting/caret_background_color"] = Color(0, 0, 0);
|
|
|
+ colors["text_editor/theme/highlighting/text_selected_color"] = Color(0, 0, 0, 0);
|
|
|
+ colors["text_editor/theme/highlighting/selection_color"] = Color(0.41, 0.61, 0.91, 0.35);
|
|
|
+ colors["text_editor/theme/highlighting/brace_mismatch_color"] = Color(1, 0.2, 0.2);
|
|
|
+ colors["text_editor/theme/highlighting/current_line_color"] = Color(0.3, 0.5, 0.8, 0.15);
|
|
|
+ colors["text_editor/theme/highlighting/line_length_guideline_color"] = Color(0.3, 0.5, 0.8, 0.1);
|
|
|
+ colors["text_editor/theme/highlighting/word_highlighted_color"] = Color(0.8, 0.9, 0.9, 0.15);
|
|
|
+ colors["text_editor/theme/highlighting/number_color"] = Color(0.92, 0.58, 0.2);
|
|
|
+ colors["text_editor/theme/highlighting/function_color"] = Color(0.4, 0.64, 0.81);
|
|
|
+ colors["text_editor/theme/highlighting/member_variable_color"] = Color(0.9, 0.31, 0.35);
|
|
|
+ colors["text_editor/theme/highlighting/mark_color"] = Color(1.0, 0.4, 0.4, 0.4);
|
|
|
+ colors["text_editor/theme/highlighting/warning_color"] = Color(1.0, 0.8, 0.4, 0.1);
|
|
|
+ colors["text_editor/theme/highlighting/bookmark_color"] = Color(0.08, 0.49, 0.98);
|
|
|
+ colors["text_editor/theme/highlighting/breakpoint_color"] = Color(0.9, 0.29, 0.3);
|
|
|
+ colors["text_editor/theme/highlighting/executing_line_color"] = Color(0.98, 0.89, 0.27);
|
|
|
+ colors["text_editor/theme/highlighting/code_folding_color"] = Color(0.8, 0.8, 0.8, 0.8);
|
|
|
+ colors["text_editor/theme/highlighting/folded_code_region_color"] = Color(0.68, 0.46, 0.77, 0.2);
|
|
|
+ colors["text_editor/theme/highlighting/search_result_color"] = Color(0.05, 0.25, 0.05, 1);
|
|
|
+ colors["text_editor/theme/highlighting/search_result_border_color"] = Color(0.41, 0.61, 0.91, 0.38);
|
|
|
+ colors["text_editor/theme/highlighting/gdscript/function_definition_color"] = Color(0.4, 0.9, 1.0);
|
|
|
+
|
|
|
+ colors["text_editor/theme/highlighting/gdscript/global_function_color"] = Color(0.64, 0.64, 0.96);
|
|
|
+ colors["text_editor/theme/highlighting/gdscript/node_path_color"] = Color(0.72, 0.77, 0.49);
|
|
|
+ colors["text_editor/theme/highlighting/gdscript/node_reference_color"] = Color(0.39, 0.76, 0.35);
|
|
|
+ colors["text_editor/theme/highlighting/gdscript/annotation_color"] = Color(1.0, 0.7, 0.45);
|
|
|
+ colors["text_editor/theme/highlighting/gdscript/string_name_color"] = Color(1.0, 0.76, 0.65);
|
|
|
+ colors["text_editor/theme/highlighting/comment_markers/critical_color"] = Color(0.77, 0.35, 0.35);
|
|
|
+ colors["text_editor/theme/highlighting/comment_markers/warning_color"] = Color(0.72, 0.61, 0.48);
|
|
|
+ colors["text_editor/theme/highlighting/comment_markers/notice_color"] = Color(0.56, 0.67, 0.51);
|
|
|
+ return colors;
|
|
|
+}
|
|
|
+
|
|
|
+bool EditorSettings::is_default_text_editor_theme(const String &p_theme_name) {
|
|
|
+ return p_theme_name == "default" || p_theme_name == "godot 2" || p_theme_name == "custom";
|
|
|
}
|
|
|
|
|
|
-void EditorSettings::load_text_editor_theme() {
|
|
|
- String p_file = get("text_editor/theme/color_theme");
|
|
|
-
|
|
|
- if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
|
|
|
- if (p_file == "Godot 2") {
|
|
|
- _load_godot2_text_editor_theme();
|
|
|
- }
|
|
|
- return; // sorry for "Settings changed" console spam
|
|
|
- }
|
|
|
-
|
|
|
- String theme_path = EditorPaths::get_singleton()->get_text_editor_themes_dir().path_join(p_file + ".tet");
|
|
|
-
|
|
|
- Ref<ConfigFile> cf = memnew(ConfigFile);
|
|
|
- Error err = cf->load(theme_path);
|
|
|
+void EditorSettings::update_text_editor_themes_list() {
|
|
|
+ String themes = "Default,Godot 2,Custom";
|
|
|
|
|
|
- if (err != OK) {
|
|
|
+ Ref<DirAccess> d = DirAccess::open(EditorPaths::get_singleton()->get_text_editor_themes_dir());
|
|
|
+ if (d.is_null()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- Vector<String> keys = cf->get_section_keys("color_theme");
|
|
|
-
|
|
|
- for (const String &key : keys) {
|
|
|
- String val = cf->get_value("color_theme", key);
|
|
|
-
|
|
|
- // don't load if it's not already there!
|
|
|
- if (has_setting("text_editor/theme/highlighting/" + key)) {
|
|
|
- // make sure it is actually a color
|
|
|
- if (val.is_valid_html_color() && key.contains("color")) {
|
|
|
- props["text_editor/theme/highlighting/" + key].variant = Color::html(val); // change manually to prevent "Settings changed" console spam
|
|
|
- }
|
|
|
+ PackedStringArray custom_themes;
|
|
|
+ d->list_dir_begin();
|
|
|
+ String file = d->get_next();
|
|
|
+ while (!file.is_empty()) {
|
|
|
+ if (file.get_extension() == "tet" && !is_default_text_editor_theme(file.get_basename().to_lower())) {
|
|
|
+ custom_themes.push_back(file.get_basename());
|
|
|
}
|
|
|
+ file = d->get_next();
|
|
|
}
|
|
|
- emit_signal(SNAME("settings_changed"));
|
|
|
- // if it doesn't load just use what is currently loaded
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorSettings::import_text_editor_theme(const String &p_file) {
|
|
|
- if (!p_file.ends_with(".tet")) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- if (p_file.get_file().to_lower() == "default.tet") {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ d->list_dir_end();
|
|
|
|
|
|
- Ref<DirAccess> d = DirAccess::open(EditorPaths::get_singleton()->get_text_editor_themes_dir());
|
|
|
- if (d.is_valid()) {
|
|
|
- d->copy(p_file, EditorPaths::get_singleton()->get_text_editor_themes_dir().path_join(p_file.get_file()));
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorSettings::save_text_editor_theme() {
|
|
|
- String p_file = get("text_editor/theme/color_theme");
|
|
|
-
|
|
|
- if (_is_default_text_editor_theme(p_file.get_file().to_lower())) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- String theme_path = EditorPaths::get_singleton()->get_text_editor_themes_dir().path_join(p_file + ".tet");
|
|
|
- return _save_text_editor_theme(theme_path);
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorSettings::save_text_editor_theme_as(String p_file) {
|
|
|
- if (!p_file.ends_with(".tet")) {
|
|
|
- p_file += ".tet";
|
|
|
- }
|
|
|
-
|
|
|
- if (_is_default_text_editor_theme(p_file.get_file().to_lower().trim_suffix(".tet"))) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (_save_text_editor_theme(p_file)) {
|
|
|
- // switch to theme is saved in the theme directory
|
|
|
- list_text_editor_themes();
|
|
|
- String theme_name = p_file.substr(0, p_file.length() - 4).get_file();
|
|
|
-
|
|
|
- if (p_file.get_base_dir() == EditorPaths::get_singleton()->get_text_editor_themes_dir()) {
|
|
|
- _initial_set("text_editor/theme/color_theme", theme_name);
|
|
|
- load_text_editor_theme();
|
|
|
- }
|
|
|
- return true;
|
|
|
+ if (!custom_themes.is_empty()) {
|
|
|
+ custom_themes.sort();
|
|
|
+ themes += "," + String(",").join(custom_themes);
|
|
|
}
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
-bool EditorSettings::is_default_text_editor_theme() {
|
|
|
- String p_file = get("text_editor/theme/color_theme");
|
|
|
- return _is_default_text_editor_theme(p_file.get_file().to_lower());
|
|
|
+ add_property_hint(PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, themes));
|
|
|
}
|
|
|
|
|
|
Vector<String> EditorSettings::get_script_templates(const String &p_extension, const String &p_custom_path) {
|