mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2024-12-18 18:35:55 +01:00
27 lines
598 B
JavaScript
27 lines
598 B
JavaScript
|
import { ipcMain, nativeTheme } from 'electron'
|
||
|
|
||
|
export default (mainWindow) => {
|
||
|
const appTheme = {
|
||
|
value() {
|
||
|
return nativeTheme.themeSource
|
||
|
},
|
||
|
update(value) {
|
||
|
nativeTheme.themeSource = value
|
||
|
},
|
||
|
isDark() {
|
||
|
return nativeTheme.shouldUseDarkColors
|
||
|
},
|
||
|
}
|
||
|
|
||
|
Object.entries(appTheme).forEach(([key, handler]) => {
|
||
|
ipcMain.handle(`app-theme-${key}`, (_, value) => handler(value))
|
||
|
})
|
||
|
|
||
|
nativeTheme.on('updated', () => {
|
||
|
mainWindow.webContents.send('app-theme-change', {
|
||
|
isDark: appTheme.isDark(),
|
||
|
value: appTheme.value(),
|
||
|
})
|
||
|
})
|
||
|
}
|