Skip to content

Commit

Permalink
Merge pull request #3 from catdad-experiments/#2-maskable-icon
Browse files Browse the repository at this point in the history
adding a maskable and monochrome icon, greatly simplifying the app icon
  • Loading branch information
catdad authored Jan 12, 2024
2 parents bb13496 + 5cf75ca commit 864ded6
Show file tree
Hide file tree
Showing 5 changed files with 774 additions and 344 deletions.
47 changes: 47 additions & 0 deletions assets/build-icons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const path = require('path');
const { promises: fs } = require('fs');
const { generateIcons } = require('svg-app-icon');

const input = (...parts) => path.resolve(__dirname, ...parts);
const output = (...parts) => path.resolve(__dirname, '../icons', ...parts);

const background = '#cac9c8';

(async () => {
await fs.rm(output(), { force: true, recursive: true });
await fs.mkdir(output());

const svg = await fs.readFile(input('icon.svg'));

for await (const icon of generateIcons([`<svg viewBox="0 0 10 10"><circle cx="5" cy="5" r="5" fill="${background}"/></svg>`, svg], {
ico: false,
icns: false,
svg: true,
png: true,
pngSizes: [48, 192, 512]
})) {
await fs.writeFile(output(icon.name), icon.buffer);
}

for await (const icon of generateIcons([`<svg viewBox="0 0 10 10"><rect x="0" y="0" width="10" height="10" fill="${background}" /></svg>`, svg], {
ico: false,
icns: false,
svg: false,
png: true,
pngSizes: [48, 192, 512]
})) {
const name = `${path.parse(icon.name).name}-maskable.${icon.ext}`;
await fs.writeFile(output(name), icon.buffer);
}

for await (const icon of generateIcons([svg], {
ico: false,
icns: false,
svg: false,
png: true,
pngSizes: [48, 192]
})) {
const name = `${path.parse(icon.name).name}-monochrome.${icon.ext}`;
await fs.writeFile(output(name), icon.buffer);
}
})();
Loading

0 comments on commit 864ded6

Please sign in to comment.