mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(tray): support dark theme for icons
This commit is contained in:
parent
736f329857
commit
4701edff4c
@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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
|
if ! command -v inkscape &> /dev/null; then
|
||||||
echo "This tool requires Inkscape to be render sharper SVGs than ImageMagick."
|
echo "This tool requires Inkscape to be render sharper SVGs than ImageMagick."
|
||||||
exit 1
|
exit 1
|
||||||
@ -11,4 +16,5 @@ output_dir="$script_dir/../../images/app-icons/tray"
|
|||||||
for file in *.svg; do
|
for file in *.svg; do
|
||||||
name=$(basename $file .svg)
|
name=$(basename $file .svg)
|
||||||
inkscape -w 16 -h 16 "$file" -o "$output_dir/$name-16.png"
|
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
|
done
|
BIN
images/app-icons/tray/bookmarks-inverted-16.png
Normal file
BIN
images/app-icons/tray/bookmarks-inverted-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 320 B |
BIN
images/app-icons/tray/close-inverted-16.png
Normal file
BIN
images/app-icons/tray/close-inverted-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 242 B |
BIN
images/app-icons/tray/new-note-inverted-16.png
Normal file
BIN
images/app-icons/tray/new-note-inverted-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 236 B |
BIN
images/app-icons/tray/recents-inverted-16.png
Normal file
BIN
images/app-icons/tray/recents-inverted-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 425 B |
BIN
images/app-icons/tray/today-inverted-16.png
Normal file
BIN
images/app-icons/tray/today-inverted-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 380 B |
@ -9,6 +9,7 @@ import type BNote from "../becca/entities/bnote.js";
|
|||||||
import becca from "../becca/becca.js";
|
import becca from "../becca/becca.js";
|
||||||
import becca_service from "../becca/becca_service.js";
|
import becca_service from "../becca/becca_service.js";
|
||||||
import type BRecentNote from "../becca/entities/brecent_note.js";
|
import type BRecentNote from "../becca/entities/brecent_note.js";
|
||||||
|
import { nativeTheme } from "electron/main";
|
||||||
|
|
||||||
let tray: Tray;
|
let tray: Tray;
|
||||||
// `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window
|
// `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) {
|
function getIconPath(name: string) {
|
||||||
const size = 16;
|
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() {
|
function registerVisibilityListener() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user