LibGUI: Use SystemColor::Text in more places
This commit is contained in:
parent
79f7482ad3
commit
9171aef724
Notes:
sideshowbarker
2024-07-19 10:43:41 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9171aef7245
6 changed files with 9 additions and 7 deletions
|
@ -35,6 +35,8 @@ enum class SystemColor {
|
||||||
ThreedShadow1,
|
ThreedShadow1,
|
||||||
ThreedShadow2,
|
ThreedShadow2,
|
||||||
HoverHighlight,
|
HoverHighlight,
|
||||||
|
|
||||||
|
DisabledText = ThreedShadow1,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Color {
|
class Color {
|
||||||
|
|
|
@ -154,7 +154,7 @@ void GAbstractButton::paint_text(GPainter& painter, const Rect& rect, const Font
|
||||||
|
|
||||||
if (text().is_empty())
|
if (text().is_empty())
|
||||||
return;
|
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())
|
if (is_focused())
|
||||||
painter.draw_rect(clipped_rect.inflated(6, 4), Color(140, 140, 140));
|
painter.draw_rect(clipped_rect.inflated(6, 4), Color(140, 140, 140));
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ void GListView::paint_event(GPaintEvent& event)
|
||||||
if (is_selected_row)
|
if (is_selected_row)
|
||||||
text_color = Color::White;
|
text_color = Color::White;
|
||||||
else
|
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;
|
auto text_rect = row_rect;
|
||||||
text_rect.move_by(horizontal_padding(), 0);
|
text_rect.move_by(horizontal_padding(), 0);
|
||||||
text_rect.set_width(text_rect.width() - horizontal_padding() * 2);
|
text_rect.set_width(text_rect.width() - horizontal_padding() * 2);
|
||||||
|
|
|
@ -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);
|
StylePainter::paint_button(painter, increment_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::IncrementButton);
|
||||||
|
|
||||||
if (length(orientation()) > default_button_size()) {
|
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(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() ? 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() ? SystemColor::Text : SystemColor::DisabledText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_scrubber())
|
if (has_scrubber())
|
||||||
|
|
|
@ -95,7 +95,7 @@ void GTableView::paint_event(GPaintEvent& event)
|
||||||
if (is_selected_row)
|
if (is_selected_row)
|
||||||
text_color = Color::White;
|
text_color = Color::White;
|
||||||
else
|
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);
|
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ void GTreeView::paint_event(GPaintEvent& event)
|
||||||
|
|
||||||
bool is_selected_row = selection().contains(index);
|
bool is_selected_row = selection().contains(index);
|
||||||
|
|
||||||
Color text_color = Color::Black;
|
Color text_color = SystemColor::Text;
|
||||||
if (is_selected_row)
|
if (is_selected_row)
|
||||||
text_color = Color::White;
|
text_color = Color::White;
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ void GTreeView::paint_event(GPaintEvent& event)
|
||||||
painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
|
painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
|
||||||
} else {
|
} else {
|
||||||
if (!is_selected_row)
|
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);
|
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue