mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 00:46:45 +00:00
fix(icons): resolve macOS icon black edge artifacts
Split Sharp pipeline into two stages to fix edge pixel blending. When chained directly, dest-in composite and flatten don't properly preserve alpha channel data, causing edges to retain the original icon color instead of blending with the white background. Fixes #6323
This commit is contained in:
parent
d54e458404
commit
8b645c33ea
2 changed files with 13 additions and 2 deletions
BIN
build/icon.icns
BIN
build/icon.icns
Binary file not shown.
|
|
@ -130,11 +130,22 @@ async function generateMacIcon() {
|
|||
for (const { osType, size } of ICNS_TYPES) {
|
||||
const svg = continuousRoundedRectSvg(size);
|
||||
|
||||
const pngBuffer = await sharp(SOURCE_PNG)
|
||||
// Step 1: Resize and apply squircle mask
|
||||
// NOTE: Must output to PNG buffer before flatten. When chained directly,
|
||||
// Sharp's internal pipeline doesn't properly preserve alpha channel data
|
||||
// between dest-in composite and flatten, causing edge pixels to retain
|
||||
// the original icon color instead of blending with the background.
|
||||
// See: https://github.com/super-productivity/super-productivity/issues/6323
|
||||
const maskedPng = await sharp(SOURCE_PNG)
|
||||
.resize(size, size, { fit: 'cover', position: 'center' })
|
||||
.composite([{ input: Buffer.from(svg), blend: 'dest-in' }])
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
// Step 2: Flatten with white background (properly blends alpha at edges)
|
||||
// Note: flatten() already removes alpha, so removeAlpha() is not needed
|
||||
const pngBuffer = await sharp(maskedPng)
|
||||
.flatten({ background: { r: 255, g: 255, b: 255 } })
|
||||
.removeAlpha()
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue