mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: expose app accessibility transparency settings api (#40073)
This commit is contained in:
@@ -435,6 +435,10 @@ Returns an object with system animation settings.
|
||||
|
||||
## Properties
|
||||
|
||||
### `systemPreferences.accessibilityDisplayShouldReduceTransparency()` _macOS_
|
||||
|
||||
A `boolean` property which determines whether the app avoids using semitransparent backgrounds. This maps to [NSWorkspace.accessibilityDisplayShouldReduceTransparency](https://developer.apple.com/documentation/appkit/nsworkspace/1533006-accessibilitydisplayshouldreduce)
|
||||
|
||||
### `systemPreferences.appLevelAppearance` _macOS_ _Deprecated_
|
||||
|
||||
A `string` property that can be `dark`, `light` or `unknown`. It determines the macOS appearance setting for
|
||||
|
||||
@@ -110,6 +110,9 @@ gin::ObjectTemplateBuilder SystemPreferences::GetObjectTemplateBuilder(
|
||||
.SetMethod("isTrustedAccessibilityClient",
|
||||
&SystemPreferences::IsTrustedAccessibilityClient)
|
||||
.SetMethod("askForMediaAccess", &SystemPreferences::AskForMediaAccess)
|
||||
.SetProperty(
|
||||
"accessibilityDisplayShouldReduceTransparency",
|
||||
&SystemPreferences::AccessibilityDisplayShouldReduceTransparency)
|
||||
#endif
|
||||
.SetMethod("getAnimationSettings",
|
||||
&SystemPreferences::GetAnimationSettings);
|
||||
|
||||
@@ -96,6 +96,7 @@ class SystemPreferences
|
||||
gin::Arguments* args);
|
||||
void RemoveUserDefault(const std::string& name);
|
||||
bool IsSwipeTrackingFromScrollEventsEnabled();
|
||||
bool AccessibilityDisplayShouldReduceTransparency();
|
||||
|
||||
std::string GetSystemColor(gin_helper::ErrorThrower thrower,
|
||||
const std::string& color);
|
||||
|
||||
@@ -653,4 +653,9 @@ void SystemPreferences::SetAppLevelAppearance(gin::Arguments* args) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SystemPreferences::AccessibilityDisplayShouldReduceTransparency() {
|
||||
return [[NSWorkspace sharedWorkspace]
|
||||
accessibilityDisplayShouldReduceTransparency];
|
||||
}
|
||||
|
||||
} // namespace electron::api
|
||||
|
||||
Reference in New Issue
Block a user