Customize & Beautify your Windows Terminal (2022 Edition)
Anson Heung
Posted on January 28, 2022
Windows Terminal is a modern terminal application for developers who frequently uses command-line tools such as Powershell. In this article, I’ll show you how to customize the hell out of Windows Terminal and Powershell so that you can flex on your friends and colleagues 😎.
Here's our final result 👇
Before we begin, please download Windows Terminal from the Microsoft Store.
Table of Contents:
Windows Terminal Settings
You can open settings via the Ctrl+, shortcut or the dropdown menu:
Color Scheme
My color scheme is a slightly modified version of Sonokai Shusia. To install the color scheme:
- Open Settings in Windows Terminal and press the “Open JSON file” button at the bottom left corner. It will open
settings.json
in Notepad. -
In
settings.json
, scroll down to find the"schemes"
field, which accepts an array of color scheme objects. Next, paste in my color scheme object before the first object in the array (note that object order does not matter).
{ ... "schemes": [ { "name": "Sonokai Shusia", "background": "#2D2A2E", "black": "#1A181A", "blue": "#1080D0", "brightBlack": "#707070", "brightBlue": "#22D5FF", "brightCyan": "#7ACCD7", "brightGreen": "#A4CD7C", "brightPurple": "#AB9DF2", "brightRed": "#F882A5", "brightWhite": "#E3E1E4", "brightYellow": "#E5D37E", "cursorColor": "#FFFFFF", "cyan": "#3AA5D0", "foreground": "#E3E1E4", "green": "#7FCD2B", "purple": "#7C63F2", "red": "#F82F66", "selectionBackground": "#FFFFFF", "white": "#E3E1E4", "yellow": "#E5DE2D" }, ... ] }
-
Save your changes and head back to Windows Terminal. Go to Settings → "Windows Powershell" profile → "Appearance" tab → "Color Scheme", and choose the new color scheme. Then, press "Save".
If you don’t like my custom theme, check out Windows Terminal Themes website. There are 200+ themes to choose from and you get a quick preview of each theme 🌈.
Nerd Font
Nerd Fonts refer to programming fonts that are patched with a high number of glyphs (icons). Using a nerd font in Windows Terminal is essential because normal monospace fonts cannot render icons properly:
It’s likely that the programming font you’re using (eg. Cascadia Code, Fira Code) already has a Nerd Font version. Check out this link to see the full list of patched Nerd Fonts that you can install.
In my setup, I use Fira Code Nerd Font. The link will download a ZIP file that contains many TrueType font files. It’s OK to only install the files where the name looks something like Fira Code XXXXX Nerd Font Complete Windows Compatible
.
After installing Nerd Font:
- Restart your Windows Terminal by closing and re-opening it.
- Go to Settings → “Windows Powershell” profile → “Appearance” tab → “Font face”, and choose your newly installed Nerd Font:
Now, your Terminal should look a bit more pleasing to the eyes:
Oh My Posh
Oh My Posh is a prompt theme engine that lets you beautify the prompt string. This engine requires your Terminal to use a Nerd Font so make sure that you followed along the previous steps.
Setup
-
Install “App Installer” from Microsoft Store to get the
winget
Windows Package Manager CLI.- ⚠ Requires Windows 10 1809 (build 17763) or later
- Check out Oh My Posh’s documentation for alternative installation options.
Restart your Windows Terminal and run
winget
to check if the package manager is correctly installed.-
In your Windows Terminal, run
winget install JanDeDobbeleer.OhMyPosh
Restart your Windows Terminal. Next, try running
oh-my-posh
in Powershell to see if it’s correctly installed.
-
Run the following command to open your Powershell profile.
notepad $PROFILE
If notepad shows a prompt saying that “Microsoft.Powershell_profile.ps1” is not found and asks if you would like to create the file, press “Yes” to create the file.
-
Inside the file, paste in the following code and save the file. This will load Oh My Posh on start-up with the default theme.
oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json | Invoke-Expression
Restart your Terminal. Your Powershell should now load Oh My Posh automatically
Change Theme
Oh My Posh comes with >70 themes included out-of-the-box. Check out the “Themes” page documentation for a gallery of preinstalled themes.
All themes are located in ~\AppData\Local\Programs\oh-my-posh\themes
if you used winget
to install Oh My Posh. If you used an alternative installation method, visit the documentation and select your installation method to see where the themes are located.
Suppose you want to use the powerlevel10k_rainbow preinstalled theme:
Open Windows Terminal and run
notepad $PROFILE
in Powershell just like we did previously.-
In the opened file, change the path after
--config
so that it usespowerlevel10k_rainbow.omp.json
:
oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/powerlevel10k_rainbow.omp.json | Invoke-Expression
Custom Themes
You can easily create your own theme by writing your own JSON files. Here are some useful links:
- “Configuration → General” page of the docs - Learn how to create custom themes
- Nerd Font’s cheatsheet - List of different glyphs that you can use
I created a custom theme called p10k_classic
, which is inspired by a preinstalled theme called powerlevel10k_classic.
To use my theme:
Visit the GitHub Gist link and click the “Download ZIP” button at the top right corner.
Extract
p10k_classic.omp.json
into a location of your choice. For example, let’s place it in the root folder (~
).Open Windows Terminal and run
notepad $PROFILE
in Powershell.-
In the opened file, change the path after
--config
so that it uses~/p10k_classic.omp.json
oh-my-posh --init --shell pwsh --config ~/p10k_classic.omp.json | Invoke-Expression
Winfetch
As an added bonus, we’ll install winfetch, a command-line tool that prints out system information. This is a great alternative to neofetch, which only works on Linux.
Setup
This wiki page lists several ways to install winfetch. We’re using the first recommended method: PSGallery.
Run Windows Terminal as administrator. To do that, search “Windows Terminal” in the Start Menu, right click the item, and press “Run as administrator”
-
In Powershell, run the command:
Install-Script -Name pwshfetch-test-1
Choose “Yes” for any prompts you encountered.
-
Run
notepad $PROFILE
to open Powershell profile. Add the following line of code at the end:
Set-Alias winfetch pwshfetch-test-1
Restart your Terminal. Then, run
winfetch
to see if it’s correctly installed.
The default winfetch config is saved to ~\.config\winfetch\config.ps1
. Check out the “Configuration” wiki page to see all available configuration options.
Custom Image
The Windows logo at the left can be changed to a custom “image” (more like a low resolution pixel art because Windows Terminal cannot render full resolution images).
For example, I want to display my GitHub profile picture, which is a 8-bit Luigi art:
Save this image and place it in a location of your choice. For example, I save it at the root folder (
~
) with the nameluigi.png
.-
Open
~\.config\winfetch\config.ps1
in Notepad. Change the first two variables to the following:
# ===== WINFETCH CONFIGURATION ===== $image = "C:\Users\User\luigi.png" # ABSOLUTE path $noimage = $false
⚠ I used absolute path in
$image
because winfetch in my PC is having trouble processing a relative path (~/luigi.png
). The full path of my root folder isC:\Users\User
.
More Configuration
By default, winfetch only shows information about your C drive. To show all available drives, open ~\.config\winfetch\config.ps1
and uncomment the field:
# Configure which disks are shown
# $ShowDisks = @("C:", "D:")
# Show all available disks
$ShowDisks = @("*")
You can also display a bar chart for the memory (RAM) and disk usage:
# Configure how to show info for levels
# Default is for text only.
# 'bar' is for bar only.
# 'textbar' is for text + bar.
# 'bartext' is for bar + text.
# $cpustyle = 'bar'
$memorystyle = 'bartext'
$diskstyle = 'bartext'
# $batterystyle = 'bartext'
Here’s our final result:
That’s all the steps you needed to beautify your Terminal 🌈. Now it’s time for you to show off in front of your friends and colleagues! 😁
Thanks for reading! If you find it useful, don’t forget to like and share this post 🙌
Posted on January 28, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.