f8c640d386
* feat: add transparency checking to nativeTheme Refs https://chromium-review.googlesource.com/c/chromium/src/+/4684870 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: deprecate previous function Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: fix lint Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
22 lines
988 B
TypeScript
22 lines
988 B
TypeScript
import * as deprecate from '@electron/internal/common/deprecate';
|
|
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
|
|
|
|
if ('getEffectiveAppearance' in systemPreferences) {
|
|
const nativeEAGetter = systemPreferences.getEffectiveAppearance;
|
|
Object.defineProperty(systemPreferences, 'effectiveAppearance', {
|
|
get: () => nativeEAGetter.call(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;
|