From f7a567f07c26b831751987cd53563fa409940f88 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 9 May 2022 09:55:03 -0400 Subject: [PATCH] generate more pngs Signed-off-by: Sebastian Malton --- build/generate-tray-icons.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/build/generate-tray-icons.ts b/build/generate-tray-icons.ts index bf6f2dbee1..c09ab6320d 100644 --- a/build/generate-tray-icons.ts +++ b/build/generate-tray-icons.ts @@ -17,18 +17,31 @@ const svgData = readFileSync(inputFile, { encoding: "utf-8" }); const svgDom = new JSDOM(`${svgData}`); const svgRoot = svgDom.window.document.body.getElementsByTagName("svg")[0]; +svgRoot.innerHTML += ``; +const lightTemplate = svgRoot.outerHTML; + svgRoot.innerHTML += ``; +const darkTemplate = svgRoot.outerHTML; + console.log("Generating tray icon pngs"); ensureDirSync(outputFolder); Promise.allSettled([ - sharp(Buffer.from(svgRoot.outerHTML)) + sharp(Buffer.from(darkTemplate)) + .resize({ width: size, height: size }) + .png() + .toFile(path.join(outputFolder, "trayIconDarkTemplate.png")), + sharp(Buffer.from(darkTemplate)) + .resize({ width: size*2, height: size*2 }) + .png() + .toFile(path.join(outputFolder, "trayIconDarkTemplate@2x.png")), + sharp(Buffer.from(lightTemplate)) .resize({ width: size, height: size }) .png() .toFile(path.join(outputFolder, "trayIconTemplate.png")), - sharp(Buffer.from(svgRoot.outerHTML)) + sharp(Buffer.from(lightTemplate)) .resize({ width: size*2, height: size*2 }) .png() .toFile(path.join(outputFolder, "trayIconTemplate@2x.png")),