mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
feat: Tray icon theme now follows system theme
This commit is contained in:
parent
9fcb6da960
commit
ce778afff6
3 changed files with 5 additions and 2 deletions
BIN
public/img/icons/menu-dark@88.png
Normal file
BIN
public/img/icons/menu-dark@88.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
|
@ -1,6 +1,6 @@
|
||||||
/* global __static */
|
/* global __static */
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { app, nativeImage, Tray, Menu } from 'electron';
|
import { app, nativeImage, Tray, Menu, nativeTheme } from 'electron';
|
||||||
import { isLinux } from '@/utils/platform';
|
import { isLinux } from '@/utils/platform';
|
||||||
|
|
||||||
function createMenuTemplate(win) {
|
function createMenuTemplate(win) {
|
||||||
|
|
@ -197,8 +197,11 @@ class YPMTrayWindowsImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTray(win, eventEmitter) {
|
export function createTray(win, eventEmitter) {
|
||||||
|
// 感觉图标颜色应该不属于界面主题范畴,只需要跟随系统主题
|
||||||
|
let iconTheme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark';
|
||||||
|
|
||||||
let icon = nativeImage
|
let icon = nativeImage
|
||||||
.createFromPath(path.join(__static, 'img/icons/menu@88.png'))
|
.createFromPath(path.join(__static, `img/icons/menu-${iconTheme}@88.png`))
|
||||||
.resize({
|
.resize({
|
||||||
height: 20,
|
height: 20,
|
||||||
width: 20,
|
width: 20,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue