summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhoenixFlame101 <abhinav.c.1001@gmail.com>2022-02-23 16:42:09 +0530
committerYuri Sizov <yuris@humnom.net>2022-07-20 23:05:47 +0300
commitdd8cee4b5023025f68bfa578a1ebfac3741d71e9 (patch)
treeecd438e907d1b6c4599faa4877883a17b8414880
parent3fe89e7fa9115af7057d91948450402c60abbabc (diff)
Fix code folding icon color not matching defined color
Caused by reusing icons from the main editor in the code editor. These icons were converted based on the main editor theme and not the code editor theme. - Create new icons for use specifically in the code editor - Add these icons to the exceptions when converting dark theme icons to light theme automatically - Change the default value of the code folding color to match previous color - Code folding icon is now pure white by default to correctly match the color defined in settings
-rw-r--r--editor/editor_themes.cpp20
-rw-r--r--editor/icons/CodeFoldDownArrow.svg1
-rw-r--r--editor/icons/CodeFoldedRightArrow.svg1
-rw-r--r--editor/icons/TextEditorPlay.svg1
4 files changed, 19 insertions, 4 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 13109478e4..5d60baf202 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -277,6 +277,14 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
exceptions.insert("StatusWarning");
exceptions.insert("OverbrightIndicator");
exceptions.insert("GuiMiniCheckerboard");
+
+ // Prevents Code Editor icons from changing
+ exceptions.insert("GuiTab");
+ exceptions.insert("GuiSpace");
+ exceptions.insert("CodeFoldedRightArrow");
+ exceptions.insert("CodeFoldDownArrow");
+ exceptions.insert("TextEditorPlay");
+ exceptions.insert("Breakpoint");
}
// These ones should be converted even if we are using a dark theme.
@@ -1659,7 +1667,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const float mono_value = mono_color.r;
const Color alpha1 = Color(mono_value, mono_value, mono_value, 0.07);
const Color alpha2 = Color(mono_value, mono_value, mono_value, 0.14);
- const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.7);
+ const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.27);
// editor main color
const Color main_color = dark_theme ? Color(0.34, 0.7, 1.0) : Color(0.02, 0.5, 1.0);
@@ -1749,17 +1757,21 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Now theme is loaded, apply it to CodeEdit.
theme->set_font("font", "CodeEdit", theme->get_font(SNAME("source"), SNAME("EditorFonts")));
theme->set_font_size("font_size", "CodeEdit", theme->get_font_size(SNAME("source_size"), SNAME("EditorFonts")));
+
Ref<StyleBoxFlat> code_edit_stylebox = make_flat_stylebox(EDITOR_GET("text_editor/theme/highlighting/background_color"), widget_default_margin.x, widget_default_margin.y, widget_default_margin.x, widget_default_margin.y, corner_radius);
theme->set_stylebox("normal", "CodeEdit", code_edit_stylebox);
theme->set_stylebox("read_only", "CodeEdit", code_edit_stylebox);
theme->set_stylebox("focus", "CodeEdit", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty)));
+
theme->set_icon("tab", "CodeEdit", theme->get_icon(SNAME("GuiTab"), SNAME("EditorIcons")));
theme->set_icon("space", "CodeEdit", theme->get_icon(SNAME("GuiSpace"), SNAME("EditorIcons")));
- theme->set_icon("folded", "CodeEdit", theme->get_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons")));
- theme->set_icon("can_fold", "CodeEdit", theme->get_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons")));
- theme->set_icon("executing_line", "CodeEdit", theme->get_icon(SNAME("MainPlay"), SNAME("EditorIcons")));
+ theme->set_icon("folded", "CodeEdit", theme->get_icon(SNAME("CodeFoldedRightArrow"), SNAME("EditorIcons")));
+ theme->set_icon("can_fold", "CodeEdit", theme->get_icon(SNAME("CodeFoldDownArrow"), SNAME("EditorIcons")));
+ theme->set_icon("executing_line", "CodeEdit", theme->get_icon(SNAME("TextEditorPlay"), SNAME("EditorIcons")));
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"));
+
theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0));
theme->set_color("completion_background_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_background_color"));
theme->set_color("completion_selected_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_selected_color"));
diff --git a/editor/icons/CodeFoldDownArrow.svg b/editor/icons/CodeFoldDownArrow.svg
new file mode 100644
index 0000000000..0024a1256b
--- /dev/null
+++ b/editor/icons/CodeFoldDownArrow.svg
@@ -0,0 +1 @@
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path d="m3 5 3 3 3-3" fill="none" stroke="#fff" stroke-width="2"/></svg>
diff --git a/editor/icons/CodeFoldedRightArrow.svg b/editor/icons/CodeFoldedRightArrow.svg
new file mode 100644
index 0000000000..f2a4bd44e0
--- /dev/null
+++ b/editor/icons/CodeFoldedRightArrow.svg
@@ -0,0 +1 @@
+<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path d="m4 9 3-3-3-3" fill="none" stroke="#fff" stroke-width="2"/></svg>
diff --git a/editor/icons/TextEditorPlay.svg b/editor/icons/TextEditorPlay.svg
new file mode 100644
index 0000000000..5a1d195530
--- /dev/null
+++ b/editor/icons/TextEditorPlay.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4 1048.4v-8l7 4z" fill="#e0e0e0" fill-rule="evenodd" stroke="#e0e0e0" stroke-linejoin="round" stroke-width="2" transform="translate(0 -1036.4)"/></svg>