1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 22:52:07 +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

@ -269,7 +269,7 @@ void ItemView::paint_event(PaintEvent& event)
bool is_selected_item = selection().contains(model_index);
Color background_color;
if (is_selected_item) {
background_color = is_focused() ? palette().selection() : Color::from_rgb(0x606060);
background_color = is_focused() ? palette().selection() : palette().inactive_selection();
} else {
background_color = widget_background_color;
}
@ -289,7 +289,7 @@ void ItemView::paint_event(PaintEvent& event)
Color text_color;
if (is_selected_item)
text_color = palette().selection_text();
text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
else
text_color = model()->data(model_index, Model::Role::ForegroundColor).to_color(palette().color(foreground_role()));
painter.fill_rect(text_rect, background_color);