Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Update-macOSAppearance {
- param(
- [parameter(Mandatory)]
- [ValidateSet('Dark', 'Light')]
- $Mode
- )
- $currentMode = defaults read -globalDomain AppleInterfaceStyle
- $appleScriptCommand = 'osascript -e ''tell application \"System Events\" to tell appearance preferences to set dark mode to not dark mode'''
- if ($Mode -eq 'Light' -and ($currentMode -eq "Dark")) {
- iex $appleScriptCommand
- }
- if ($Mode -eq 'Dark' -and (-not $currentMode -eq "Dark")) {
- iex $appleScriptCommand
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement