mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-12 02:30:30 +09:00
LibGUI: Use inactive selection colors from palette instead of hardcoding them
This commit is contained in:
parent
99192fd29f
commit
4d95163400
Notes:
sideshowbarker
2024-07-19 09:18:46 +09:00
Author: https://github.com/xTibor
Commit: 4d95163400
Pull-request: https://github.com/SerenityOS/serenity/pull/1224
5 changed files with 14 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue