DEV Community

Cover image for Customize & Beautify your Windows Terminal (2022 Edition)
Anson Heung
Anson Heung

Posted on • Edited on

Customize & Beautify your Windows Terminal (2022 Edition)

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 👇

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:

settings

Color Scheme

My color scheme is a slightly modified version of Sonokai Shusia. To install the color scheme:

  1. Open Settings in Windows Terminal and press the “Open JSON file” button at the bottom left corner. It will open settings.json in Notepad.
  2. 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"
          },
          ...
      ]
    }
    
  3. 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".

    change color scheme

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:

nerd font vs monospace

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:

  1. Restart your Windows Terminal by closing and re-opening it.
  2. Go to Settings → “Windows Powershell” profile → “Appearance” tab → “Font face”, and choose your newly installed Nerd Font: change font face

Now, your Terminal should look a bit more pleasing to the eyes:
custom color scheme and font


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

  1. Install “App Installer” from Microsoft Store to get the winget Windows Package Manager CLI.

  2. Restart your Windows Terminal and run winget to check if the package manager is correctly installed.

  3. In your Windows Terminal, run

    winget install JanDeDobbeleer.OhMyPosh
    
  4. Restart your Windows Terminal. Next, try running oh-my-posh in Powershell to see if it’s correctly installed.

    Default theme

  5. 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.

  6. 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
    
  7. Restart your Terminal. Your Powershell should now load Oh My Posh automatically

    Default theme on startup

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:

  1. Open Windows Terminal and run notepad $PROFILE in Powershell just like we did previously.

  2. In the opened file, change the path after --config so that it uses powerlevel10k_rainbow.omp.json:

    oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/powerlevel10k_rainbow.omp.json | Invoke-Expression
    
  3. Restart your Terminal:
    powerlevel10k_rainbow theme

Custom Themes

You can easily create your own theme by writing your own JSON files. Here are some useful links:

I created a custom theme called p10k_classic, which is inspired by a preinstalled theme called powerlevel10k_classic.

To use my theme:

  1. Visit the GitHub Gist link and click the “Download ZIP” button at the top right corner.

  2. Extract p10k_classic.omp.json into a location of your choice. For example, let’s place it in the root folder (~).

  3. Open Windows Terminal and run notepad $PROFILE in Powershell.

  4. 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
    
  5. Restart your Terminal:
    Custom p10k_classic theme


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.

  1. Run Windows Terminal as administrator. To do that, search “Windows Terminal” in the Start Menu, right click the item, and press “Run as administrator”
    Run as administrator

  2. In Powershell, run the command:

    Install-Script -Name pwshfetch-test-1
    

    Choose “Yes” for any prompts you encountered.

  3. Run notepad $PROFILE to open Powershell profile. Add the following line of code at the end:

    Set-Alias winfetch pwshfetch-test-1
    
  4. Restart your Terminal. Then, run winfetch to see if it’s correctly installed.

    winfetch default configuration

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:

GitHub avatar

  1. Save this image and place it in a location of your choice. For example, I save it at the root folder (~) with the name luigi.png.

  2. 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 is C:\Users\User.

  3. Save the file and run winfetch in Powershell:
    winfetch with custom image

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 = @("*")
Enter fullscreen mode Exit fullscreen mode

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'
Enter fullscreen mode Exit fullscreen mode

Here’s our final result:

winfetch final results


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 🙌

Top comments (13)

Collapse
 
gravesroot profile image
Juan Lorenzo Reyes Silva • Edited

Here is mine!

Windows Terminal Personal Configuration

I copied some ascii art, colored it and made it blink! If you want to see my config let me know

Collapse
 
hungnd0506 profile image
NguyenHung • Edited

Hi, would you mind sharing the config file, I got trouble displaying the ascii art, I couldn't get mine to work, I appreciate it.

Collapse
 
anderssonpeter profile image
Peter • Edited

I have started a project that I think would be a great fit (it's not done yet but it's functional)

github.com/AnderssonPeter/PowerType it gives you autocomplete for cli tools, currently it only supports a subset of git, npm and adb.

Would love some feedback!

Collapse
 
hiyorijl profile image
...

thank you!! i'm so glad i clicked i just installed it, and it's very pretty and useful

Collapse
 
aiz21 profile image
ISHU

THANKS !!!

Image description

Collapse
 
ser4ph4 profile image
Seraph4

This is good, thanks for sharing.

Collapse
 
khebrati profile image
khebrati

great article!

Collapse
 
sajeell profile image
Sajeel Ahmad

Thanks. It really worked. Nice step-wise tutorial

Collapse
 
artcancrotp profile image
artcancrotp

Seems like an awful lot of effort to get functionality that almost any Linux terminal offers right out of the box.

The one thing that I don't see that I would really like in Windows Terminal is an easily editable session directory.

Collapse
 
sahlin profile image
Sahlin

Couldn't get winfetch or pwshfetch-test-1 to work?

Collapse
 
dsschnau profile image
Dan Schnau

Thanks very much for your writeup :)

Collapse
 
rmaurodev profile image
Ricardo

Amazing. Thanks for sharing! 🚀