Change tray icon (#3037)
Signed-off-by: vshakirova <vshakirova@mirantis.com>
@ -25,20 +25,20 @@ import fs from "fs-extra";
|
|||||||
|
|
||||||
export async function generateTrayIcon(
|
export async function generateTrayIcon(
|
||||||
{
|
{
|
||||||
outputFilename = "tray_icon", // e.g. output tray_icon_dark@2x.png
|
outputFilename = "trayIcon",
|
||||||
svgIconPath = path.resolve(__dirname, "../src/renderer/components/icon/logo-lens.svg"),
|
svgIconPath = path.resolve(__dirname, "../src/renderer/components/icon/logo-lens.svg"),
|
||||||
outputFolder = path.resolve(__dirname, "./tray"),
|
outputFolder = path.resolve(__dirname, "./tray"),
|
||||||
dpiSuffix = "2x",
|
dpiSuffix = "2x",
|
||||||
pixelSize = 32,
|
pixelSize = 32,
|
||||||
shouldUseDarkColors = false, // managed by electron.nativeTheme.shouldUseDarkColors
|
shouldUseDarkColors = false, // managed by electron.nativeTheme.shouldUseDarkColors
|
||||||
} = {}) {
|
} = {}) {
|
||||||
outputFilename += shouldUseDarkColors ? "_dark" : "";
|
outputFilename += `${shouldUseDarkColors ? "Dark" : ""}Template`; // e.g. output trayIconDarkTemplate@2x.png
|
||||||
dpiSuffix = dpiSuffix !== "1x" ? `@${dpiSuffix}` : "";
|
dpiSuffix = dpiSuffix !== "1x" ? `@${dpiSuffix}` : "";
|
||||||
const pngIconDestPath = path.resolve(outputFolder, `${outputFilename}${dpiSuffix}.png`);
|
const pngIconDestPath = path.resolve(outputFolder, `${outputFilename}${dpiSuffix}.png`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Modify .SVG colors
|
// Modify .SVG colors
|
||||||
const trayIconColor = shouldUseDarkColors ? "white" : "black";
|
const trayIconColor = shouldUseDarkColors ? "black" : "white";
|
||||||
const svgDom = await jsdom.JSDOM.fromFile(svgIconPath);
|
const svgDom = await jsdom.JSDOM.fromFile(svgIconPath);
|
||||||
const svgRoot = svgDom.window.document.body.getElementsByTagName("svg")[0];
|
const svgRoot = svgDom.window.document.body.getElementsByTagName("svg")[0];
|
||||||
|
|
||||||
|
|||||||
BIN
build/tray/trayIconDarkTemplate.png
Normal file
|
After Width: | Height: | Size: 422 B |
BIN
build/tray/trayIconDarkTemplate@2x.png
Normal file
|
After Width: | Height: | Size: 925 B |
BIN
build/tray/trayIconDarkTemplate@3x.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 460 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |