fix(windows): generate 32x32 ico files (#75)

This commit is contained in:
Lucas Fernandes Nogueira
2022-07-06 11:03:56 -03:00
committed by GitHub
parent 74754209ec
commit 91cb5c0c7f
2 changed files with 7 additions and 9 deletions

5
.changes/fix-ico.md Normal file
View File

@@ -0,0 +1,5 @@
---
"tauricon": patch
---
Generate 32x32 ICO icons for better compatibility with the window icon on Windows.

View File

@@ -509,14 +509,7 @@ const tauricon = {
await this.validate(src, target)
const s = sharp(src)
const metadata = await s.metadata()
let icoBuf
if (metadata.width !== metadata.height) {
const size = Math.min(metadata.width ?? 256, metadata.height ?? 256)
icoBuf = await s.resize(size, size).toBuffer()
} else {
icoBuf = await s.toBuffer()
}
const icoBuf = await s.resize(32, 32).toBuffer()
const icns = new Icns()
for (const key in icnsImageList) {
@@ -532,7 +525,7 @@ const tauricon = {
ensureFileSync(path.join(target, '/icon.icns'))
writeFileSync(path.join(target, '/icon.icns'), icns.data)
const out2 = await pngToIco(icoBuf)
const out2 = await pngToIco([icoBuf])
if (out2 === null) {
throw new Error('Failed to create icon.ico')
}