diff --git a/bin/tray-icons/build-icons.sh b/bin/tray-icons/build-icons.sh index 7fc9954b2..2eb0c9ab8 100644 --- a/bin/tray-icons/build-icons.sh +++ b/bin/tray-icons/build-icons.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash +if ! command -v magick &> /dev/null; then + echo "This tool requires ImageMagick to be installed in order to create the icons." + exit 1 +fi + if ! command -v inkscape &> /dev/null; then echo "This tool requires Inkscape to be render sharper SVGs than ImageMagick." exit 1 @@ -11,4 +16,5 @@ output_dir="$script_dir/../../images/app-icons/tray" for file in *.svg; do name=$(basename $file .svg) inkscape -w 16 -h 16 "$file" -o "$output_dir/$name-16.png" + magick "$output_dir/$name-16.png" -channel RGB -negate "$output_dir/$name-inverted-16.png" done \ No newline at end of file diff --git a/images/app-icons/tray/bookmarks-inverted-16.png b/images/app-icons/tray/bookmarks-inverted-16.png new file mode 100644 index 000000000..8992272dd Binary files /dev/null and b/images/app-icons/tray/bookmarks-inverted-16.png differ diff --git a/images/app-icons/tray/close-inverted-16.png b/images/app-icons/tray/close-inverted-16.png new file mode 100644 index 000000000..03f5c75d1 Binary files /dev/null and b/images/app-icons/tray/close-inverted-16.png differ diff --git a/images/app-icons/tray/new-note-inverted-16.png b/images/app-icons/tray/new-note-inverted-16.png new file mode 100644 index 000000000..bc31618d8 Binary files /dev/null and b/images/app-icons/tray/new-note-inverted-16.png differ diff --git a/images/app-icons/tray/recents-inverted-16.png b/images/app-icons/tray/recents-inverted-16.png new file mode 100644 index 000000000..1db769148 Binary files /dev/null and b/images/app-icons/tray/recents-inverted-16.png differ diff --git a/images/app-icons/tray/today-inverted-16.png b/images/app-icons/tray/today-inverted-16.png new file mode 100644 index 000000000..73710e5e7 Binary files /dev/null and b/images/app-icons/tray/today-inverted-16.png differ diff --git a/src/services/tray.ts b/src/services/tray.ts index d6da1c290..207bb84d5 100644 --- a/src/services/tray.ts +++ b/src/services/tray.ts @@ -9,6 +9,7 @@ import type BNote from "../becca/entities/bnote.js"; import becca from "../becca/becca.js"; import becca_service from "../becca/becca_service.js"; import type BRecentNote from "../becca/entities/brecent_note.js"; +import { nativeTheme } from "electron/main"; let tray: Tray; // `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window @@ -35,7 +36,9 @@ function getTrayIconPath() { function getIconPath(name: string) { const size = 16; - return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "tray", `${name}-${size}.png`); + let suffix = (nativeTheme.shouldUseDarkColors ? "-inverted" : ""); + suffix += `-${size}`; + return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "tray", `${name}${suffix}.png`); } function registerVisibilityListener() {