feat: rootpage #16

Merged
Noel merged 6 commits from feat/rootpage into main 2026-10-23 19:53:14 +00:00
Showing only changes of commit 2f9f236f13 - Show all commits
+6 -4
View File
@@ -67,18 +67,20 @@ const ico = () => {
bitmap.writeUInt16LE(32, 14) // bits per pixel
bitmap.writeUInt32LE(xorSize + maskSize, 20) // image size
// XOR bitmap: bottom-up rows of BGRA.
// XOR bitmap: bottom-up rows of BGRA. With a null BACKGROUND the pixel stays
// zeroed and alpha 0, which is how a 32bpp ICO carries transparency.
let offset = 40
for (let y = SIZE - 1; y >= 0; y--) {
for (let x = 0; x < SIZE; x++) {
const [r, g, b] = hex(colorAt(x, y) ?? '#000000')
const color = colorAt(x, y)
const [r, g, b] = color ? hex(color) : [0, 0, 0]
bitmap[offset++] = b
bitmap[offset++] = g
bitmap[offset++] = r
bitmap[offset++] = 0xff
bitmap[offset++] = color ? 0xff : 0
}
}
// AND mask stays zeroed: every pixel is opaque.
// AND mask stays zeroed: 32bpp readers use the alpha channel instead.
const header = Buffer.alloc(6)
header.writeUInt16LE(0, 0) // reserved