本文整理匯總了TypeScript中electron.systemPreferences.isDarkMode方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript systemPreferences.isDarkMode方法的具體用法?TypeScript systemPreferences.isDarkMode怎麽用?TypeScript systemPreferences.isDarkMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.systemPreferences
的用法示例。
在下文中一共展示了systemPreferences.isDarkMode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
ipcMain.on('set-vibrancy', () => {
mainWindow.setVibrancy('sidebar');
if (config.get('followSystemAppearance')) {
systemPreferences.setAppLevelAppearance(systemPreferences.isDarkMode() ? 'dark' : 'light');
} else {
systemPreferences.setAppLevelAppearance(config.get('darkMode') ? 'dark' : 'light');
}
});
示例2: makeDefaultConfig
function makeDefaultConfig() {
const IsDarkMode = process.platform === 'darwin' && systemPreferences.isDarkMode();
const menubarBroken = process.platform === 'win32';
return {
hot_key: 'CmdOrCtrl+Shift+S',
icon_color: IsDarkMode ? 'white' : 'black',
always_on_top: false,
normal_window: menubarBroken,
zoom_factor: 0.9,
home_url: 'https://mobile.twitter.com',
notification: true,
refresh_on_sleep: true,
refresh_threshold_memory_mb: 500,
plugins: [],
keymaps: {
/* tslint:disable:object-literal-key-quotes */
j: 'next-tweet',
k: 'previous-tweet',
esc: 'unfocus-tweet',
f: 'scroll-down-page',
b: 'scroll-up-page',
t: 'scroll-up-to-top',
'1': 'switch-home-timeline',
'2': 'switch-notifications',
'3': 'switch-direct-messages',
'4': 'switch-search',
n: 'new-tweet',
enter: 'reply-tweet',
R: 'retweet-tweet',
Q: 'quote-tweet',
L: 'like-tweet',
i: 'open-images',
I: 'open-images-in-browser',
o: 'open-tweet',
l: 'open-links',
u: 'show-user',
backspace: 'browser-go-back',
'ctrl+enter': 'send-tweet',
'mod+plus': 'zoom-in',
'mod+-': 'zoom-out',
'mod+shift+l': 'last-account',
'mod+shift+n': 'next-account',
'mod+shift+p': 'previous-account',
/* tslint:enable:object-literal-key-quotes */
},
accounts: null,
} as Config;
}