git ssb

16+

Dominic / patchbay



Tree: a32c4b1713d7a46d55c2e27257ffbe0ec9a5ef01

Files: a32c4b1713d7a46d55c2e27257ffbe0ec9a5ef01 / build / build-icon.js

725 bytesRaw
1const fs = require('fs')
2const path = require('path')
3const sharp = require('sharp')
4const toIco = require('to-ico')
5const icnsConvert = require('@fiahfy/icns-convert')
6
7const image = sharp(path.resolve(__dirname, 'icon.svg'))
8const sizes = [24, 32, 48, 64, 96, 128, 256]
9
10Promise.all(sizes.map(makeIcon)).then((bufs) => {
11 createIco(bufs)
12 createIcns(bufs)
13})
14
15function makeIcon (size) {
16 return image
17 .resize(size, size)
18 .png()
19 .toBuffer()
20}
21
22function createIco (bufs) {
23 toIco(bufs).then(buf => {
24 fs.writeFileSync(path.resolve(__dirname, 'icon.ico'), buf)
25 })
26}
27
28function createIcns (bufs) {
29 icnsConvert(bufs).then((data) => {
30 fs.writeFileSync(path.resolve(__dirname, 'icon.icns'), data)
31 })
32}
33

Built with git-ssb-web