Skip to content

Instantly share code, notes, and snippets.

@dartov
Last active August 14, 2017 11:34
Show Gist options
  • Save dartov/c19d6d5ae5ac33d18373720bd4cbd2af to your computer and use it in GitHub Desktop.
Save dartov/c19d6d5ae5ac33d18373720bd4cbd2af to your computer and use it in GitHub Desktop.
Scripts to switch dark mode / light mode for my main apps
-- turn on Dark Mode on macOS
tell application "System Events"
tell appearance preferences
set dark mode to true
end tell
end tell
-- turn on Dark Palette on OmniFocus
tell application "OmniFocus"
set value of preference id "OFIColorPaletteIdentifier" to "builtin:OmniFocus Dark"
end tell
-- copy settings file to Sublime Text 3
do shell script "cp ~/etc/ST3_pref_dark.json ~/Library/Application\\ Support/Sublime\\ Text\\ 3/Packages/User/Preferences.sublime-settings"
-- iTerm
-- Ideally I would change profile or default profile, but it's not exposed to AppleScript
tell application "iTerm"
repeat with theWindow in windows
repeat with theTab in tabs of theWindow
repeat with theSession in sessions of theTab
tell theSession
set color preset to "Solarized Dark"
end tell
end repeat
end repeat
end repeat
end tell
-- Alfred
tell application "Alfred 3"
set theme "Alfred macOS Dark"
end tell
-- Bear Notes
open location "bear://x-callback-url/change-theme?theme=Solarized%20Dark"
-- turn on Dark Mode on macOS
tell application "System Events"
tell appearance preferences
set dark mode to false
end tell
end tell
-- turn on Dark Palette on OmniFocus
tell application "OmniFocus"
set value of preference id "OFIColorPaletteIdentifier" to "default"
end tell
-- copy settings file to Sublime Text 3
do shell script "cp ~/etc/ST3_pref_light.json ~/Library/Application\\ Support/Sublime\\ Text\\ 3/Packages/User/Preferences.sublime-settings"
-- iTerm
-- Ideally I would change profile or default profile, but it's not exposed to AppleScript
tell application "iTerm"
repeat with theWindow in windows
repeat with theTab in tabs of theWindow
repeat with theSession in sessions of theTab
tell theSession
set color preset to "Solarized Light"
end tell
end repeat
end repeat
end repeat
end tell
-- Alfred
tell application "Alfred 3"
set theme "Alfred macOS"
end tell
-- Bear Notes
open location "bear://x-callback-url/change-theme?theme=Solarized%20Light"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment