Skip to content

Instantly share code, notes, and snippets.

@mkgl
Last active November 11, 2015 23:09
Show Gist options
  • Save mkgl/f5e470cb54fcdc59cd6e to your computer and use it in GitHub Desktop.
Save mkgl/f5e470cb54fcdc59cd6e to your computer and use it in GitHub Desktop.
Changing Terminal colors with style (Applescript)
global favThemes
set favThemes to {"Basic", "Pro Blue", "Pro Mint", "Pro Plum", "Pro Red", "Pro Gold", "Pro"}
tell application "Terminal"
# Get current settings
set theme to the name of the current settings of the selected tab of the front window
set i to my index_of(theme)
# Find next settings
set next to (i mod (count of favThemes) + 1)
set nextTheme to item next of favThemes
# Apply next settings
set current settings of the selected tab of the front window to item 1 of (settings sets whose name is nextTheme)
end tell
on index_of(this_item)
repeat with i from 1 to the count of favThemes
if item i of favThemes is this_item then return i
end repeat
return 0
end index_of
@mkgl
Copy link
Author

mkgl commented Nov 11, 2015

Changing Terminal colors with style

For some time I wanted to get that nerdy script updating colors of Terminal windows—helping distinguish them when multi-tasking/getting myself (heavily) side-tracked.

Except the pseudo-designer in me could simply not bear random dodgy color schemes ;) so I ended up rolling my own script. It essentially cycles through a list of predefined Terminal window settings; I carefully curated colorful variations of the "Pro" theme + the "Basic" one.

Terminal Colors

Thanks to the interwebs for the 45-minute dose of Applescript basics, and for the index_of function. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment