Skip to content

Commit

Permalink
app list: use white bg color for transparent icons
Browse files Browse the repository at this point in the history
  • Loading branch information
vgmoose committed Dec 1, 2023
1 parent eb193e8 commit 390877a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ const getFirstPixelFromImage = (img) => {
context.drawImage(img, 0, 0, img.width, img.height);
const buf8 = context.getImageData(1, 1, 1, 1).data;
var data = new Uint32Array(buf8);

// if the pixel is transparent, return white
if ((data[3] || 0) === 0) {
return 'rgb(255, 255, 255)';
}

return `rgb(${data[0]}, ${data[1]}, ${data[2]})`;
}

Expand Down

0 comments on commit 390877a

Please sign in to comment.