Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function Update-macOSAppearance {
  2. param(
  3. [parameter(Mandatory)]
  4. [ValidateSet('Dark', 'Light')]
  5. $Mode
  6. )
  7.  
  8. $currentMode = defaults read -globalDomain AppleInterfaceStyle
  9. $appleScriptCommand = 'osascript -e ''tell application \"System Events\" to tell appearance preferences to set dark mode to not dark mode'''
  10. if ($Mode -eq 'Light' -and ($currentMode -eq "Dark")) {
  11. iex $appleScriptCommand
  12. }
  13.  
  14. if ($Mode -eq 'Dark' -and (-not $currentMode -eq "Dark")) {
  15. iex $appleScriptCommand
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement