1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09:00

LibGUI: Tint selected icons in {Icon,Table,Columns}View

Add a gentle tint to selected icons based on the selection color. :^)
This commit is contained in:
Andreas Kling 2020-10-26 21:32:27 +01:00
parent d172783d33
commit 4bc8768737
Notes: sideshowbarker 2024-07-19 01:41:51 +09:00
3 changed files with 16 additions and 5 deletions

View file

@ -121,10 +121,14 @@ void TableView::paint_event(PaintEvent& event)
painter.blit(cell_rect.location(), data.as_bitmap(), data.as_bitmap().rect());
} else if (data.is_icon()) {
if (auto bitmap = data.as_icon().bitmap_for_size(16)) {
if (m_hovered_index.is_valid() && cell_index.row() == m_hovered_index.row())
if (is_selected_row) {
auto tint = palette().selection().with_alpha(100);
painter.blit_filtered(cell_rect.location(), *bitmap, bitmap->rect(), [&](auto src) { return src.blend(tint); });
} else if (m_hovered_index.is_valid() && cell_index.row() == m_hovered_index.row()) {
painter.blit_brightened(cell_rect.location(), *bitmap, bitmap->rect());
else
} else {
painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
}
}
} else {
if (!is_selected_row) {