1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:35:08 +00:00

LibGUI: Use inactive selection colors from palette instead of hardcoding them

This commit is contained in:
Tibor Nagy 2020-02-15 16:24:20 +01:00 committed by Andreas Kling
parent 99192fd29f
commit 4d95163400
5 changed files with 14 additions and 12 deletions

View file

@ -85,8 +85,8 @@ void TableView::paint_event(PaintEvent& event)
Color background_color;
Color key_column_background_color;
if (is_selected_row) {
background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
key_column_background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
background_color = is_focused() ? palette().selection() : palette().inactive_selection();
key_column_background_color = is_focused() ? palette().selection() : palette().inactive_selection();
} else {
if (alternating_row_colors() && (painted_item_index % 2)) {
background_color = widget_background_color.darkened(0.8f);
@ -125,7 +125,7 @@ void TableView::paint_event(PaintEvent& event)
} else {
Color text_color;
if (is_selected_row)
text_color = palette().selection_text();
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
else
text_color = model()->data(cell_index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, Gfx::TextElision::Right);