mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00: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:
parent
d172783d33
commit
4bc8768737
3 changed files with 16 additions and 5 deletions
|
@ -457,7 +457,10 @@ void IconView::paint_event(PaintEvent& event)
|
|||
Gfx::IntRect destination = bitmap->rect();
|
||||
destination.center_within(item_data.icon_rect);
|
||||
|
||||
if (m_hovered_index.is_valid() && m_hovered_index == item_data.index) {
|
||||
if (item_data.selected) {
|
||||
auto tint = palette().selection().with_alpha(100);
|
||||
painter.blit_filtered(destination.location(), *bitmap, bitmap->rect(), [&](auto src) { return src.blend(tint); });
|
||||
} else if (m_hovered_index.is_valid() && m_hovered_index == item_data.index) {
|
||||
painter.blit_brightened(destination.location(), *bitmap, bitmap->rect());
|
||||
} else {
|
||||
painter.blit(destination.location(), *bitmap, bitmap->rect());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue