LibGUI: Use SystemColor::Text in more places

This commit is contained in:
Andreas Kling 2019-12-24 01:29:18 +01:00
parent 79f7482ad3
commit 9171aef724
Notes: sideshowbarker 2024-07-19 10:43:41 +09:00
6 changed files with 9 additions and 7 deletions

View File

@ -35,6 +35,8 @@ enum class SystemColor {
ThreedShadow1,
ThreedShadow2,
HoverHighlight,
DisabledText = ThreedShadow1,
};
class Color {

View File

@ -154,7 +154,7 @@ void GAbstractButton::paint_text(GPainter& painter, const Rect& rect, const Font
if (text().is_empty())
return;
painter.draw_text(clipped_rect, text(), font, text_alignment, foreground_color(), TextElision::Right);
painter.draw_text(clipped_rect, text(), font, text_alignment, SystemColor::Text, TextElision::Right);
if (is_focused())
painter.draw_rect(clipped_rect.inflated(6, 4), Color(140, 140, 140));
}

View File

@ -129,7 +129,7 @@ void GListView::paint_event(GPaintEvent& event)
if (is_selected_row)
text_color = Color::White;
else
text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(Color::Black);
text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
auto text_rect = row_rect;
text_rect.move_by(horizontal_padding(), 0);
text_rect.set_width(text_rect.width() - horizontal_padding() * 2);

View File

@ -209,8 +209,8 @@ void GScrollBar::paint_event(GPaintEvent& event)
StylePainter::paint_button(painter, increment_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::IncrementButton);
if (length(orientation()) > default_button_size()) {
painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? Color::Black : Color::MidGray);
painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? Color::Black : Color::MidGray);
painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? SystemColor::Text : SystemColor::DisabledText);
painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? SystemColor::Text : SystemColor::DisabledText);
}
if (has_scrubber())

View File

@ -95,7 +95,7 @@ void GTableView::paint_event(GPaintEvent& event)
if (is_selected_row)
text_color = Color::White;
else
text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(Color::Black);
text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
}
}

View File

@ -178,7 +178,7 @@ void GTreeView::paint_event(GPaintEvent& event)
bool is_selected_row = selection().contains(index);
Color text_color = Color::Black;
Color text_color = SystemColor::Text;
if (is_selected_row)
text_color = Color::White;
@ -226,7 +226,7 @@ void GTreeView::paint_event(GPaintEvent& event)
painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
} else {
if (!is_selected_row)
text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(Color::Black);
text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
}
}