Detecting Reduced Transparency

Mac OSX specific forum
mrbungle
Enthusiast
Enthusiast
Posts: 176
Joined: Wed Dec 30, 2020 3:18 am

Detecting Reduced Transparency

Post by mrbungle »

For years, I ran my Mac with a white menu bar, but the default is actually to have transparency enabled. There are differences, particularly with images and icons, so here's a way of detecting a user's environment and whether they have reduced transparency enabled or not:

Code: Select all

Procedure.b IsReduceTransparencyEnabled()
  Protected result.i
  Protected workspace = CocoaMessage(0, 0, "NSWorkspace sharedWorkspace")
  If workspace
    result = CocoaMessage(0, workspace, "accessibilityDisplayShouldReduceTransparency")
    ProcedureReturn result
  EndIf
  ProcedureReturn #False
EndProcedure

If IsReduceTransparencyEnabled()
  Debug "Reduced Transparency is ENABLED"
Else
  Debug "Reduced Transparency is DISABLED"
EndIf