mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-03-14 00:25:15 +08:00
feat: Tray icon theme now follows system theme
This commit is contained in:
parent
9fcb6da960
commit
ce778afff6
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 */
|
||||
import path from 'path';
|
||||
import { app, nativeImage, Tray, Menu } from 'electron';
|
||||
import { app, nativeImage, Tray, Menu, nativeTheme } from 'electron';
|
||||
import { isLinux } from '@/utils/platform';
|
||||
|
||||
function createMenuTemplate(win) {
|
||||
@ -197,8 +197,11 @@ class YPMTrayWindowsImpl {
|
||||
}
|
||||
|
||||
export function createTray(win, eventEmitter) {
|
||||
// 感觉图标颜色应该不属于界面主题范畴,只需要跟随系统主题
|
||||
let iconTheme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark';
|
||||
|
||||
let icon = nativeImage
|
||||
.createFromPath(path.join(__static, 'img/icons/menu@88.png'))
|
||||
.createFromPath(path.join(__static, `img/icons/menu-${iconTheme}@88.png`))
|
||||
.resize({
|
||||
height: 20,
|
||||
width: 20,
|
||||
|
Loading…
x
Reference in New Issue
Block a user