How to use the electron-util.api.nativeTheme function in electron-util

To help you get started, we’ve selected a few electron-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sindresorhus / caprine / source / browser.ts View on Github external
function setDarkMode(): void {
	if (is.macos && config.get('followSystemAppearance')) {
		api.nativeTheme.themeSource = 'system';
	} else {
		api.nativeTheme.themeSource = config.get('darkMode') ? 'dark' : 'light';
	}

	document.documentElement.classList.toggle('dark-mode', api.nativeTheme.shouldUseDarkColors);
	updateVibrancy();
}
github sindresorhus / caprine / source / browser.ts View on Github external
function setDarkMode(): void {
	if (is.macos && config.get('followSystemAppearance')) {
		api.nativeTheme.themeSource = 'system';
	} else {
		api.nativeTheme.themeSource = config.get('darkMode') ? 'dark' : 'light';
	}

	document.documentElement.classList.toggle('dark-mode', api.nativeTheme.shouldUseDarkColors);
	updateVibrancy();
}