diff --git a/public/assets/icons/about-black.png b/public/assets/icons/about-black.png new file mode 100644 index 000000000..2d8e1f1da Binary files /dev/null and b/public/assets/icons/about-black.png differ diff --git a/public/assets/icons/metadata.png b/public/assets/icons/about-white.png similarity index 100% rename from public/assets/icons/metadata.png rename to public/assets/icons/about-white.png diff --git a/public/assets/icons/chromium-black.png b/public/assets/icons/chromium-black.png new file mode 100644 index 000000000..405a750f9 Binary files /dev/null and b/public/assets/icons/chromium-black.png differ diff --git a/public/assets/icons/chromium.png b/public/assets/icons/chromium-white.png similarity index 100% rename from public/assets/icons/chromium.png rename to public/assets/icons/chromium-white.png diff --git a/public/assets/icons/com-list-black.png b/public/assets/icons/com-list-black.png new file mode 100644 index 000000000..01e15e0b4 Binary files /dev/null and b/public/assets/icons/com-list-black.png differ diff --git a/public/assets/icons/com-list.png b/public/assets/icons/com-list-white.png similarity index 100% rename from public/assets/icons/com-list.png rename to public/assets/icons/com-list-white.png diff --git a/public/assets/icons/copy-black.png b/public/assets/icons/copy-black.png new file mode 100644 index 000000000..256a69400 Binary files /dev/null and b/public/assets/icons/copy-black.png differ diff --git a/public/assets/icons/copy.png b/public/assets/icons/copy-white.png similarity index 100% rename from public/assets/icons/copy.png rename to public/assets/icons/copy-white.png diff --git a/public/assets/icons/cut-black.png b/public/assets/icons/cut-black.png new file mode 100644 index 000000000..fa447df84 Binary files /dev/null and b/public/assets/icons/cut-black.png differ diff --git a/public/assets/icons/cut.png b/public/assets/icons/cut-white.png similarity index 100% rename from public/assets/icons/cut.png rename to public/assets/icons/cut-white.png diff --git a/public/assets/icons/det-list-black.png b/public/assets/icons/det-list-black.png new file mode 100644 index 000000000..3652de934 Binary files /dev/null and b/public/assets/icons/det-list-black.png differ diff --git a/public/assets/icons/det-list.png b/public/assets/icons/det-list-white.png similarity index 100% rename from public/assets/icons/det-list.png rename to public/assets/icons/det-list-white.png diff --git a/public/assets/icons/developer-tool-black.png b/public/assets/icons/developer-tool-black.png new file mode 100644 index 000000000..cc9981711 Binary files /dev/null and b/public/assets/icons/developer-tool-black.png differ diff --git a/public/assets/icons/developer-tool.png b/public/assets/icons/developer-tool-white.png similarity index 100% rename from public/assets/icons/developer-tool.png rename to public/assets/icons/developer-tool-white.png diff --git a/public/assets/icons/export-black.png b/public/assets/icons/export-black.png new file mode 100644 index 000000000..432d2c578 Binary files /dev/null and b/public/assets/icons/export-black.png differ diff --git a/public/assets/icons/export.png b/public/assets/icons/export-white.png similarity index 100% rename from public/assets/icons/export.png rename to public/assets/icons/export-white.png diff --git a/public/assets/icons/follow-up-black.png b/public/assets/icons/follow-up-black.png new file mode 100644 index 000000000..769549dcd Binary files /dev/null and b/public/assets/icons/follow-up-black.png differ diff --git a/public/assets/icons/follow-up.png b/public/assets/icons/follow-up-white.png similarity index 100% rename from public/assets/icons/follow-up.png rename to public/assets/icons/follow-up-white.png diff --git a/public/assets/icons/full-screen-black.png b/public/assets/icons/full-screen-black.png new file mode 100644 index 000000000..37845d1f7 Binary files /dev/null and b/public/assets/icons/full-screen-black.png differ diff --git a/public/assets/icons/full-screen.png b/public/assets/icons/full-screen-white.png similarity index 100% rename from public/assets/icons/full-screen.png rename to public/assets/icons/full-screen-white.png diff --git a/public/assets/icons/github-black.png b/public/assets/icons/github-black.png new file mode 100644 index 000000000..2b52515f0 Binary files /dev/null and b/public/assets/icons/github-black.png differ diff --git a/public/assets/icons/github.png b/public/assets/icons/github-white.png similarity index 100% rename from public/assets/icons/github.png rename to public/assets/icons/github-white.png diff --git a/public/assets/icons/json-black.png b/public/assets/icons/json-black.png new file mode 100644 index 000000000..e54a90278 Binary files /dev/null and b/public/assets/icons/json-black.png differ diff --git a/public/assets/icons/json-file.png b/public/assets/icons/json-white.png similarity index 100% rename from public/assets/icons/json-file.png rename to public/assets/icons/json-white.png diff --git a/public/assets/icons/log-black.png b/public/assets/icons/log-black.png new file mode 100644 index 000000000..d35f1469d Binary files /dev/null and b/public/assets/icons/log-black.png differ diff --git a/public/assets/icons/log.png b/public/assets/icons/log-white.png similarity index 100% rename from public/assets/icons/log.png rename to public/assets/icons/log-white.png diff --git a/public/assets/icons/notice-black.png b/public/assets/icons/notice-black.png new file mode 100644 index 000000000..a962232fb Binary files /dev/null and b/public/assets/icons/notice-black.png differ diff --git a/public/assets/icons/notice.png b/public/assets/icons/notice-white.png similarity index 100% rename from public/assets/icons/notice.png rename to public/assets/icons/notice-white.png diff --git a/public/assets/icons/open-black.png b/public/assets/icons/open-black.png new file mode 100644 index 000000000..fb6a48dd1 Binary files /dev/null and b/public/assets/icons/open-black.png differ diff --git a/public/assets/icons/open.png b/public/assets/icons/open-white.png similarity index 100% rename from public/assets/icons/open.png rename to public/assets/icons/open-white.png diff --git a/public/assets/icons/paste-black.png b/public/assets/icons/paste-black.png new file mode 100644 index 000000000..a8ad0cd20 Binary files /dev/null and b/public/assets/icons/paste-black.png differ diff --git a/public/assets/icons/paste.png b/public/assets/icons/paste-white.png similarity index 100% rename from public/assets/icons/paste.png rename to public/assets/icons/paste-white.png diff --git a/public/assets/icons/quit-black.png b/public/assets/icons/quit-black.png new file mode 100644 index 000000000..7502cc25d Binary files /dev/null and b/public/assets/icons/quit-black.png differ diff --git a/public/assets/icons/quit.png b/public/assets/icons/quit-white.png similarity index 100% rename from public/assets/icons/quit.png rename to public/assets/icons/quit-white.png diff --git a/public/assets/icons/redo-black.png b/public/assets/icons/redo-black.png new file mode 100644 index 000000000..04f73b9ad Binary files /dev/null and b/public/assets/icons/redo-black.png differ diff --git a/public/assets/icons/redo.png b/public/assets/icons/redo-white.png similarity index 100% rename from public/assets/icons/redo.png rename to public/assets/icons/redo-white.png diff --git a/public/assets/icons/restore-black.png b/public/assets/icons/restore-black.png new file mode 100644 index 000000000..41e8ec278 Binary files /dev/null and b/public/assets/icons/restore-black.png differ diff --git a/public/assets/icons/path.png b/public/assets/icons/restore-white.png similarity index 100% rename from public/assets/icons/path.png rename to public/assets/icons/restore-white.png diff --git a/public/assets/icons/save-black.png b/public/assets/icons/save-black.png new file mode 100644 index 000000000..f6cd4ca8e Binary files /dev/null and b/public/assets/icons/save-black.png differ diff --git a/public/assets/icons/save.png b/public/assets/icons/save-white.png similarity index 100% rename from public/assets/icons/save.png rename to public/assets/icons/save-white.png diff --git a/public/assets/icons/search-black.png b/public/assets/icons/search-black.png new file mode 100644 index 000000000..8939757a3 Binary files /dev/null and b/public/assets/icons/search-black.png differ diff --git a/public/assets/icons/search.png b/public/assets/icons/search-white.png similarity index 100% rename from public/assets/icons/search.png rename to public/assets/icons/search-white.png diff --git a/public/assets/icons/select-all-black.png b/public/assets/icons/select-all-black.png new file mode 100644 index 000000000..31a5f6393 Binary files /dev/null and b/public/assets/icons/select-all-black.png differ diff --git a/public/assets/icons/select-all.png b/public/assets/icons/select-all-white.png similarity index 100% rename from public/assets/icons/select-all.png rename to public/assets/icons/select-all-white.png diff --git a/public/assets/icons/statictics-black.png b/public/assets/icons/statictics-black.png new file mode 100644 index 000000000..e809d7a98 Binary files /dev/null and b/public/assets/icons/statictics-black.png differ diff --git a/public/assets/icons/statictics.png b/public/assets/icons/statictics-white.png similarity index 100% rename from public/assets/icons/statictics.png rename to public/assets/icons/statictics-white.png diff --git a/public/assets/icons/undo-black.png b/public/assets/icons/undo-black.png new file mode 100644 index 000000000..3eedc8532 Binary files /dev/null and b/public/assets/icons/undo-black.png differ diff --git a/public/assets/icons/undo.png b/public/assets/icons/undo-white.png similarity index 100% rename from public/assets/icons/undo.png rename to public/assets/icons/undo-white.png diff --git a/public/assets/icons/update-black.png b/public/assets/icons/update-black.png new file mode 100644 index 000000000..7657ab100 Binary files /dev/null and b/public/assets/icons/update-black.png differ diff --git a/public/assets/icons/updated.png b/public/assets/icons/update-white.png similarity index 100% rename from public/assets/icons/updated.png rename to public/assets/icons/update-white.png diff --git a/public/assets/icons/user-guide-black.png b/public/assets/icons/user-guide-black.png new file mode 100644 index 000000000..200b15c0a Binary files /dev/null and b/public/assets/icons/user-guide-black.png differ diff --git a/public/assets/icons/user-guide.png b/public/assets/icons/user-guide-white.png similarity index 100% rename from public/assets/icons/user-guide.png rename to public/assets/icons/user-guide-white.png diff --git a/public/assets/icons/yaml-black.png b/public/assets/icons/yaml-black.png new file mode 100644 index 000000000..5ec8c30fa Binary files /dev/null and b/public/assets/icons/yaml-black.png differ diff --git a/public/assets/icons/yaml.png b/public/assets/icons/yaml-white.png similarity index 100% rename from public/assets/icons/yaml.png rename to public/assets/icons/yaml-white.png diff --git a/public/assets/icons/zoom-in-black.png b/public/assets/icons/zoom-in-black.png new file mode 100644 index 000000000..16bf74bac Binary files /dev/null and b/public/assets/icons/zoom-in-black.png differ diff --git a/public/assets/icons/zoom-in.png b/public/assets/icons/zoom-in-white.png similarity index 100% rename from public/assets/icons/zoom-in.png rename to public/assets/icons/zoom-in-white.png diff --git a/public/assets/icons/zoom-out-black.png b/public/assets/icons/zoom-out-black.png new file mode 100644 index 000000000..bd43031b6 Binary files /dev/null and b/public/assets/icons/zoom-out-black.png differ diff --git a/public/assets/icons/zoom-out.png b/public/assets/icons/zoom-out-white.png similarity index 100% rename from public/assets/icons/zoom-out.png rename to public/assets/icons/zoom-out-white.png diff --git a/src/ElectronBackend/main/menu.ts b/src/ElectronBackend/main/menu.ts index 2e6d0be4c..fe01fd054 100644 --- a/src/ElectronBackend/main/menu.ts +++ b/src/ElectronBackend/main/menu.ts @@ -4,7 +4,7 @@ // // SPDX-License-Identifier: Apache-2.0 -import { app, BrowserWindow, Menu, shell } from 'electron'; +import electron, { app, BrowserWindow, Menu, shell } from 'electron'; import { AllowedFrontendChannels } from '../../shared/ipc-channels'; import { getOpenFileListener, @@ -23,13 +23,15 @@ import path from 'path'; export function createMenu(mainWindow: BrowserWindow): Menu { const webContents = mainWindow.webContents; - + const nativeTheme = electron.nativeTheme; return Menu.buildFromTemplate([ { label: 'File', submenu: [ { - icon: path.join(getBasePathOfAssets(), 'icons/open.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/open-white.png') + : path.join(getBasePathOfAssets(), 'icons/open-black.png'), label: 'Open File', accelerator: 'CmdOrCtrl+O', click(): void { @@ -37,7 +39,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/save.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/save-white.png') + : path.join(getBasePathOfAssets(), 'icons/save-black.png'), label: 'Save', accelerator: 'CmdOrCtrl+S', click(): void { @@ -48,11 +52,15 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, { label: 'Export', - icon: path.join(getBasePathOfAssets(), 'icons/export.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/export-white.png') + : path.join(getBasePathOfAssets(), 'icons/export-black.png'), submenu: [ { label: 'Follow-Up', - icon: path.join(getBasePathOfAssets(), 'icons/follow-up.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/follow-up-white.png') + : path.join(getBasePathOfAssets(), 'icons/follow-up-black.png'), click(): void { setLoadingState(mainWindow.webContents, true); webContents.send( @@ -62,7 +70,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/com-list.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/com-list-white.png') + : path.join(getBasePathOfAssets(), 'icons/com-list-black.png'), label: 'Compact component list', click(): void { setLoadingState(mainWindow.webContents, true); @@ -73,7 +83,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/det-list.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/det-list-white.png') + : path.join(getBasePathOfAssets(), 'icons/det-list-black.png'), label: 'Detailed component list', click(): void { setLoadingState(mainWindow.webContents, true); @@ -84,7 +96,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/yaml.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/yaml-white.png') + : path.join(getBasePathOfAssets(), 'icons/yaml-black.png'), label: 'SPDX (yaml)', click(): void { setLoadingState(mainWindow.webContents, true); @@ -95,7 +109,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/json-file.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/json-white.png') + : path.join(getBasePathOfAssets(), 'icons/json-black.png'), label: 'SPDX (json)', click(): void { setLoadingState(mainWindow.webContents, true); @@ -108,7 +124,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { ], }, { - icon: path.join(getBasePathOfAssets(), 'icons/metadata.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/about-white.png') + : path.join(getBasePathOfAssets(), 'icons/about-black.png'), label: 'Project Metadata', click(): void { if (isFileLoaded(getGlobalBackendState())) { @@ -122,7 +140,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/statictics.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/statictics-white.png') + : path.join(getBasePathOfAssets(), 'icons/statictics-black.png'), label: 'Project Statistics', click(): void { if (isFileLoaded(getGlobalBackendState())) { @@ -136,14 +156,18 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/path.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/restore-white.png') + : path.join(getBasePathOfAssets(), 'icons/restore-black.png'), label: 'Set Path to Sources', click(): void { getSelectBaseURLListener(mainWindow)(); }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/quit.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/quit-white.png') + : path.join(getBasePathOfAssets(), 'icons/quit-black.png'), label: 'Quit', accelerator: 'CmdOrCtrl+Q', click(): void { @@ -156,45 +180,59 @@ export function createMenu(mainWindow: BrowserWindow): Menu { label: 'Edit', submenu: [ { - icon: path.join(getBasePathOfAssets(), 'icons/undo.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/undo-white.png') + : path.join(getBasePathOfAssets(), 'icons/undo-black.png'), label: 'Undo', accelerator: 'CmdOrCtrl+Z', role: 'undo', }, { - icon: path.join(getBasePathOfAssets(), 'icons/redo.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/redo-white.png') + : path.join(getBasePathOfAssets(), 'icons/redo-black.png'), label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo', }, { type: 'separator' }, { - icon: path.join(getBasePathOfAssets(), 'icons/cut.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/cut-white.png') + : path.join(getBasePathOfAssets(), 'icons/cut-black.png'), label: 'Cut', accelerator: 'CmdOrCtrl+X', role: 'cut', }, { - icon: path.join(getBasePathOfAssets(), 'icons/copy.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/copy-white.png') + : path.join(getBasePathOfAssets(), 'icons/copy-black.png'), label: 'Copy', accelerator: 'CmdOrCtrl+C', role: 'copy', }, { - icon: path.join(getBasePathOfAssets(), 'icons/paste.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/paste-white.png') + : path.join(getBasePathOfAssets(), 'icons/paste-black.png'), label: 'Paste', accelerator: 'CmdOrCtrl+V', role: 'paste', }, { - icon: path.join(getBasePathOfAssets(), 'icons/select-all.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/select-all-white.png') + : path.join(getBasePathOfAssets(), 'icons/select-all-black.png'), label: 'Select All', accelerator: 'CmdOrCtrl+A', role: 'selectAll', }, { type: 'separator' }, { - icon: path.join(getBasePathOfAssets(), 'icons/search.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/search-white.png') + : path.join(getBasePathOfAssets(), 'icons/search-black.png'), label: 'Search for Files and Directories', accelerator: 'CmdOrCtrl+F', click(): void { @@ -211,22 +249,33 @@ export function createMenu(mainWindow: BrowserWindow): Menu { label: 'View', submenu: [ { - icon: path.join(getBasePathOfAssets(), 'icons/developer-tool.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/developer-tool-white.png') + : path.join( + getBasePathOfAssets(), + 'icons/developer-tool-black.png' + ), label: 'Show Developer Tools', role: 'toggleDevTools', }, { - icon: path.join(getBasePathOfAssets(), 'icons/full-screen.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/full-screen-white.png') + : path.join(getBasePathOfAssets(), 'icons/full-screen-black.png'), label: 'Full Screen', role: 'togglefullscreen', }, { - icon: path.join(getBasePathOfAssets(), 'icons/zoom-in.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/zoom-in-white.png') + : path.join(getBasePathOfAssets(), 'icons/zoom-in-black.png'), label: 'Zoom In', role: 'zoomIn', }, { - icon: path.join(getBasePathOfAssets(), 'icons/zoom-out.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/zoom-out-white.png') + : path.join(getBasePathOfAssets(), 'icons/zoom-out-black.png'), label: 'Zoom Out', role: 'zoomOut', }, @@ -236,7 +285,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { label: 'About', submenu: [ { - icon: path.join(getBasePathOfAssets(), 'icons/github.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/github-white.png') + : path.join(getBasePathOfAssets(), 'icons/github-black.png'), label: 'Open on GitHub', click: async (): Promise => { await shell.openExternal( @@ -245,14 +296,18 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/notice.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/notice-white.png') + : path.join(getBasePathOfAssets(), 'icons/notice-black.png'), label: 'OpossumUI Notices', click: async (): Promise => { await shell.openPath(getPathOfNoticeDocument()); }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/chromium.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/chromium-white.png') + : path.join(getBasePathOfAssets(), 'icons/chromium-black.png'), label: 'Chromium Notices', click: async (): Promise => { await shell.openPath(getPathOfChromiumNoticeDocument()); @@ -264,7 +319,9 @@ export function createMenu(mainWindow: BrowserWindow): Menu { label: 'Help', submenu: [ { - icon: path.join(getBasePathOfAssets(), 'icons/user-guide.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/user-guide-white.png') + : path.join(getBasePathOfAssets(), 'icons/user-guide-black.png'), label: "User's Guide", click: async (): Promise => { await shell.openExternal( @@ -273,14 +330,18 @@ export function createMenu(mainWindow: BrowserWindow): Menu { }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/log.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/log-white.png') + : path.join(getBasePathOfAssets(), 'icons/log-black.png'), label: 'Open log files folder', click: async (): Promise => { await shell.openPath(app.getPath('logs')); }, }, { - icon: path.join(getBasePathOfAssets(), 'icons/updated.png'), + icon: nativeTheme?.shouldUseDarkColors + ? path.join(getBasePathOfAssets(), 'icons/update-white.png') + : path.join(getBasePathOfAssets(), 'icons/update-black.png'), label: 'Check for updates', click(): void { webContents.send(AllowedFrontendChannels.ShowUpdateAppPopup, {