Make Your Terminal Phenerminal: Customizing Colors and Prompts
Tags: tutorial, zsh, terminal, mac
Published: 2020-07-02 17:15:00

###### Cover illustration by me, Sidney

When I was a kid, opening up Terminal and playing [emacs games](https://www.masteringemacs.org/article/fun-games-in-emacs) or watching [telnet star wars](https://lifehacker.com/watch-star-wars-in-text-via-telnet-373571) felt like the ultimate hacker experience. Now that I use the command line for more mundane tasks like navigating my directories and generating Rails apps, I like the interface to be a little more exciting than the simple black-and-white default. 

As a total beginner, I didn't know there was such a thing as a framework like [Oh My Zsh](https://ohmyz.sh/), which lets you choose from its vast collection of themes– I didn't even know you could use programs other than Terminal as terminal emulators! Here's how I made my vanilla Zsh Terminal pretty in a very simple way.

## Terminal Themes and Colors

If you open up Terminal's Preferences panel, you'll be able to choose from or edit themes, or "profiles." 

![The Terminal preferences window on the Profiles tab.](https://dev-to-uploads.s3.amazonaws.com/i/2q9pw84e8y9zsaaqgt5k.png)

You could create your own profile from scratch, choosing the [ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code) colors by hand, but I wanted my Terminal to take on the color scheme [Solarized](https://ethanschoonover.com/solarized/) by Ethan Schoonover. Luckily, you can download a `.terminal` file from the site that, when opened, creates a new Terminal profile with the Solarized colors.

A whole lot more `.terminal` files can be found in [this repository by lysyi3m](https://github.com/lysyi3m/macos-terminal-themes)– if your computer won't let you open them because they're from an unidentified developer, just right-click and "Open With" Terminal. (Make sure 'display ANSI colors' is checked.)

If you install a Zsh framework like Oh My Zsh, changing themes can be as simple as [editing a line in your configuration file.](https://github.com/ohmyzsh/ohmyzsh/wiki/themes)

You know what else is as simple as editing a line in your configuration file?

## Putting a Frog in Your Prompt

When I was tipped off that you could customize your command-line prompt, there was one obvious question I had to find out the answer to– "Can I put a frog in it?"

Fortunately, gloriously, the answer is yes (as long as your terminal supports unicode, which it should). And I'm far from the first person to [think](https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html) - [of](https://osxdaily.com/2013/04/08/add-emoji-command-line-bash-prompt/) - [putting](https://loige.co/random-emoji-in-your-prompt-how-and-why/) - [emojis](https://medium.com/@joshuaxavier/how-to-customise-your-command-prompt-to-include-an-emoji-647e1f3e4027) - [in the prompt](https://thomasweng.com/emoji_in_terminal/).

With zsh, you'll want to look for a file in your root directory called `zshrc`. (It might be a hidden dotfile, which you can show in Finder by doing ⌘ + ⇧ + .) Once inside with the text editor of your choice, your target is the line that contains the default `prompt`, which in Zsh is something like `%m%#`. 

Looking at a zsh prompt can be intimidating if you don't know how to read it, but all the prompt escapes can be found [here](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Prompt-Expansion) in the zsh manual. `%m` gives the machine's hostname up to the first dot, and `%#` shows a `#` only if the shell is running with privileges.

Here's my prompt, step by step:

```
PS1="%F{green} %2~ 🐸 > %f"
```

* `%F{color}` starts a color, in my case `green` to match my frog friend
* `%2~` shows a `~` at the home directory, or else the last two folders in your path when you're navigating around
* `🐸` and `>`, characters on their own, followed by a space
* `%f` ends a color, returning my input to the default blue.

## All Together Now

As a final touch, I got rid of that "last login" message by running `touch .hushlogin` in my root directory. Here's what a new Terminal window looks like, in the Solarized Light profile: 

![Ahhh.](https://dev-to-uploads.s3.amazonaws.com/i/hchnqkaxzt2lfug57tal.png)

Ahhh.

## More Resources

Armin Briegel at [scriptingosx.com](https://scriptingosx.com/) does a great job explaining [how to customize the zsh prompt,](https://scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/) and has a whole book on moving to zsh from bash. I highly recommend looking at his posts on [minimal Terminal](https://scriptingosx.com/2017/07/minimal-terminal-prompt/) and [rotating background colors](https://scriptingosx.com/2016/04/randomize-window-backgrounds-in-terminal/), if you really want to get fancy.

Laurie's post, below, outlines a way to get a different emoji depending on whether your last command was successful:

{% link https://dev.to/laurieontech/adding-an-emoji-status-to-terminal-zsh-4cnd %}

And if you're a command-line beginner like me, it's worth it to make use of aliases to supercharge your experience, as my classmate Anmol writes about here: (just put the aliases into your `zshrc` file instead of `bashrc`)

{% medium https://medium.com/@anmolpreet.kaur/how-to-save-valuable-time-with-bash-aliases-452bf02f206d %}

Happy emoji-ing!