Change OSX Terminal Settings from Command Line
Changing fonts and colors should be easy, also with terminals. Alas, neither iTerm2 nor OSX Terminal seem to have an easy way of doing this: you need to define a new profile or change some presets of the current profile. This is often an overkill.
- Grab colors.csv (a GitHub gist) and save it in your home. The file contains
all colors known to Emacs (with
M-x list-colors-display) with the corresponding representation used by AppleScript.
- Grab the set_colors.bash (another GitHub gist) and add its content
.bash_profile(or source the file, if you prefer)
You are done! You can now change colors from your terminal using the following commands:
set_theme foreground-color <color-name>
$ set_foreground_color wheat $ set_background_color gray10 $ set_font "Oxygen Mono" 12
Now that you can change colors using a bash function, some opportunities arise. For instance, you can use the command line to change the terminal colors when connecting to a different host.