feat: add transparency checking to nativeTheme
(#42862)
* feat: add transparency checking to nativeTheme
Refs 4684870
* chore: deprecate previous function
* chore: fix lint
This commit is contained in:
parent
9fc760bc4c
commit
5669a40d5c
8 changed files with 48 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import * as deprecate from '@electron/internal/common/deprecate';
|
||||
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
|
||||
|
||||
if ('getEffectiveAppearance' in systemPreferences) {
|
||||
|
@ -7,4 +8,15 @@ if ('getEffectiveAppearance' in systemPreferences) {
|
|||
});
|
||||
}
|
||||
|
||||
if ('accessibilityDisplayShouldReduceTransparency' in systemPreferences) {
|
||||
const reduceTransparencyDeprecated = deprecate.warnOnce('systemPreferences.accessibilityDisplayShouldReduceTransparency', 'nativeTheme.prefersReducedTransparency');
|
||||
const nativeReduceTransparency = systemPreferences.accessibilityDisplayShouldReduceTransparency;
|
||||
Object.defineProperty(systemPreferences, 'accessibilityDisplayShouldReduceTransparency', {
|
||||
get: () => {
|
||||
reduceTransparencyDeprecated();
|
||||
return nativeReduceTransparency;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default systemPreferences;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue