Deprecate TextEdit background_color

This commit is contained in:
kit 2025-09-15 21:42:33 -04:00
parent 0b5ad6c73c
commit e2cbfb53f1
8 changed files with 14 additions and 10 deletions

View file

@ -1627,7 +1627,7 @@
</constant>
</constants>
<theme_items>
<theme_item name="background_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
<theme_item name="background_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)" deprecated="Assign a [StyleBoxFlat] to [theme_item normal] instead, and set [member StyleBoxFlat.bg_color] to the desired background color.">
Sets the background [Color] of this [TextEdit].
</theme_item>
<theme_item name="caret_background_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">

View file

@ -1388,7 +1388,6 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
node->add_child(expression_box);
register_expression_edit(p_id, expression_box);
Color background_color = EDITOR_GET("text_editor/theme/highlighting/background_color");
Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color");
Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color");
Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color");
@ -1399,7 +1398,6 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
Color members_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
expression_box->set_syntax_highlighter(expression_syntax_highlighter);
expression_box->add_theme_color_override("background_color", background_color);
for (const String &E : editor->keyword_list) {
if (ShaderLanguage::is_control_flow_keyword(E)) {
@ -5294,7 +5292,6 @@ void VisualShaderEditor::_notification(int p_what) {
shader_preview_button->set_button_icon(Control::get_editor_theme_icon(SNAME("SubViewport")));
{
Color background_color = EDITOR_GET("text_editor/theme/highlighting/background_color");
Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color");
Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color");
Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color");
@ -5305,7 +5302,6 @@ void VisualShaderEditor::_notification(int p_what) {
Color members_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
Color error_color = get_theme_color(SNAME("error_color"), EditorStringName(Editor));
preview_text->add_theme_color_override("background_color", background_color);
varying_error_label->add_theme_color_override(SceneStringName(font_color), error_color);
for (const String &E : keyword_list) {

View file

@ -600,8 +600,6 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref<EditorTheme> &p_
p_theme->set_stylebox("read_only", "CodeEdit", code_edit_stylebox);
p_theme->set_stylebox("focus", "CodeEdit", memnew(StyleBoxEmpty));
p_theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0)); // Unset any color, we use a stylebox.
/* clang-format off */
p_theme->set_color("completion_background_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_background_color"));
p_theme->set_color("completion_selected_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_selected_color"));

View file

@ -909,7 +909,6 @@ void ThemeClassic::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edi
p_theme->set_color("font_outline_color", "TextEdit", p_config.font_outline_color);
p_theme->set_color("caret_color", "TextEdit", p_config.font_color);
p_theme->set_color("selection_color", "TextEdit", p_config.selection_color);
p_theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
p_theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE);
p_theme->set_constant("outline_size", "TextEdit", 0);

View file

@ -856,7 +856,6 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
p_theme->set_color("font_outline_color", "TextEdit", p_config.font_outline_color);
p_theme->set_color("caret_color", "TextEdit", p_config.font_color);
p_theme->set_color("selection_color", "TextEdit", p_config.selection_color);
p_theme->set_color("background_color", "TextEdit", Color(1, 1, 1, 0));
p_theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE);
p_theme->set_constant("outline_size", "TextEdit", 0);

View file

@ -957,9 +957,11 @@ void TextEdit::_notification(int p_what) {
int visible_rows = get_visible_line_count() + 1;
#ifndef DISABLE_DEPRECATED
if (theme_cache.background_color.a > 0.01) {
RS::get_singleton()->canvas_item_add_rect(text_ci, Rect2(Point2i(), get_size()), theme_cache.background_color);
}
#endif // DISABLE_DEPRECATED
Vector<BraceMatchingData> brace_matching;
if (highlight_matching_braces_enabled) {
@ -7651,7 +7653,10 @@ void TextEdit::_bind_methods() {
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, TextEdit, line_spacing);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, TextEdit, wrap_offset);
#ifndef DISABLE_DEPRECATED
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, TextEdit, background_color);
#endif // DISABLE_DEPRECATED
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, TextEdit, current_line_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, TextEdit, word_highlighted_color);

View file

@ -642,9 +642,12 @@ private:
int line_spacing = 1;
int wrap_offset = 10;
Color background_color = Color(1, 1, 1);
Color current_line_color = Color(1, 1, 1);
Color word_highlighted_color = Color(1, 1, 1);
#ifndef DISABLE_DEPRECATED
Color background_color = Color(1, 1, 1);
#endif // DISABLE_DEPRECATED
} theme_cache;
bool window_has_focus = true;

View file

@ -460,7 +460,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font(SceneStringName(font), "TextEdit", Ref<Font>());
theme->set_font_size(SceneStringName(font_size), "TextEdit", -1);
#ifndef DISABLE_DEPRECATED
theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
#endif // DISABLE_DEPRECATED
theme->set_color(SceneStringName(font_color), "TextEdit", control_font_color);
theme->set_color("font_selected_color", "TextEdit", Color(0, 0, 0, 0));
theme->set_color("font_readonly_color", "TextEdit", control_font_disabled_color);
@ -501,7 +503,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font(SceneStringName(font), "CodeEdit", Ref<Font>());
theme->set_font_size(SceneStringName(font_size), "CodeEdit", -1);
#ifndef DISABLE_DEPRECATED
theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0));
#endif // DISABLE_DEPRECATED
theme->set_color("completion_background_color", "CodeEdit", Color(0.17, 0.16, 0.2));
theme->set_color("completion_selected_color", "CodeEdit", Color(0.26, 0.26, 0.27));
theme->set_color("completion_existing_color", "CodeEdit", Color(0.87, 0.87, 0.87, 0.13));