From bb86d90fb5ee5e7effa30ec07ea9c753750e840b Mon Sep 17 00:00:00 2001 From: passivestar <60579014+passivestar@users.noreply.github.com> Date: Thu, 23 Apr 2026 20:20:48 +0400 Subject: [PATCH] Fix script editor guideline colors --- editor/themes/editor_theme_manager.cpp | 4 +++- scene/gui/code_edit.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index ff04e1bdc7..5e1fba0e82 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -528,7 +528,9 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref &p_ colors["text_editor/theme/highlighting/selection_color"] = p_config.selection_color; colors["text_editor/theme/highlighting/brace_mismatch_color"] = p_config.dark_icon_and_font ? p_config.error_color : Color(1, 0.08, 0, 1); colors["text_editor/theme/highlighting/current_line_color"] = alpha1; - colors["text_editor/theme/highlighting/line_length_guideline_color"] = p_config.dark_icon_and_font ? p_config.base_color : p_config.dark_color_2; + // Contrast is positive in dark themes and negative in light themes. Lerping with a negative weight + // gives us lighter lines than base_color in dark themes and darker lines in light themes. + colors["text_editor/theme/highlighting/line_length_guideline_color"] = p_config.base_color.lerp(Color(0, 0, 0), p_config.contrast * -1.25).clamp(); colors["text_editor/theme/highlighting/word_highlighted_color"] = alpha1; colors["text_editor/theme/highlighting/number_color"] = p_config.dark_icon_and_font ? Color(0.63, 1, 0.88) : Color(0, 0.55, 0.28, 1); colors["text_editor/theme/highlighting/function_color"] = p_config.dark_icon_and_font ? Color(0.34, 0.7, 1.0) : Color(0, 0.225, 0.9, 1); diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 94b3b52f21..776afd599f 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -455,7 +455,7 @@ void CodeEdit::_draw_guidelines() { const int column_pos = theme_cache.font->get_string_size(String("0").repeat((int)line_length_guideline_columns[i]), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x; const int xoffset = xmargin_beg + column_pos - get_h_scroll(); if (xoffset > xmargin_beg && xoffset < xmargin_end) { - Color guideline_color = (i == 0) ? theme_cache.line_length_guideline_color : theme_cache.line_length_guideline_color * Color(1, 1, 1, 0.5); + Color guideline_color = (i == 0) ? theme_cache.line_length_guideline_color : theme_cache.line_length_guideline_color * Color(1, 1, 1, 0.6); if (rtl) { RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2(size.width - xoffset, 0), Point2(size.width - xoffset, size.height), guideline_color); continue;