Merge pull request #33617 from Chaosus/fix_theme_element2

Fix incorrect error/matches label color when switching from light to dark theme
This commit is contained in:
Rémi Verschelde 2019-11-14 12:38:04 +01:00 committed by GitHub
commit f244772028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -108,6 +108,8 @@ void FindReplaceBar::_notification(int p_what) {
hide_button->set_hover_texture(get_icon("Close", "EditorIcons")); hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons")); hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
} }
} }
@ -1443,6 +1445,9 @@ void CodeTextEditor::_update_font() {
text_editor->add_font_override("font", get_font("source", "EditorFonts")); text_editor->add_font_override("font", get_font("source", "EditorFonts"));
error->add_font_override("font", get_font("status_source", "EditorFonts"));
error->add_color_override("font_color", get_color("error_color", "Editor"));
Ref<Font> status_bar_font = get_font("status_source", "EditorFonts"); Ref<Font> status_bar_font = get_font("status_source", "EditorFonts");
error->add_font_override("font", status_bar_font); error->add_font_override("font", status_bar_font);
int count = status_bar->get_child_count(); int count = status_bar->get_child_count();
@ -1677,8 +1682,6 @@ CodeTextEditor::CodeTextEditor() {
error = memnew(Label); error = memnew(Label);
scroll->add_child(error); scroll->add_child(error);
error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
error->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts"));
error->set_mouse_filter(MOUSE_FILTER_STOP); error->set_mouse_filter(MOUSE_FILTER_STOP);
error->connect("gui_input", this, "_error_pressed"); error->connect("gui_input", this, "_error_pressed");
find_replace_bar->connect("error", error, "set_text"); find_replace_bar->connect("error", error, "set_text");

View File

@ -1716,6 +1716,7 @@ void FindBar::_notification(int p_what) {
hide_button->set_hover_texture(get_icon("Close", "EditorIcons")); hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons")); hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
} break; } break;
case NOTIFICATION_VISIBILITY_CHANGED: { case NOTIFICATION_VISIBILITY_CHANGED: {