Beautify your Windows Terminal 🦄
Anup Aglawe

Anup Aglawe @anupa

Joined:
May 18, 2020

Beautify your Windows Terminal 🦄

Publish Date: May 31 '20
213 56

Edit - ⚠️ With the newer version of oh-my-posh, and significant changes from V2, this article is outdated. Note that this will still work perfectly fine with V2 of oh-my-posh.


The Windows Terminal is a modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL.


Terminal

Lets start with windows Terminal installation -

  • Install the Windows Terminal from the Microsoft Store. This allows you to always be on the latest version when we release new builds with automatic upgrades.
    • Alternative Way (Via Chocolately) - choco install microsoft-windows-terminal

Next Step is to modify Windows Terminal settings.

Fire up your installed windows terminal, and open up its settings, which will open settings.json in your default editor.

  1. Under profiles list update the powershell profile to -


 {
       // Make changes here to the powershell.exe profile.
       "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
       "name": "Linnea",
       "commandline": "powershell.exe -NoLogo -NoExit",
       "hidden": false,
       "colorScheme": "Blue Matrix",
       "fontFace": "Cascadia Code PL",
       "fontSize": 10,
       "icon": "xxxxxxxxxxxxxxxxxxxxxx",
       "backgroundImage": "xxxxxxxxxxxxxxxxxxx",
       "backgroundImageOpacity": 0.2,
       "acrylicOpacity": 0.8,
       "useAcrylic": true,
       "startingDirectory": "Q:\\Development"
 },


Enter fullscreen mode Exit fullscreen mode

Properties - name-[ Appears as title in top bar ]
acrylicOpacity-[ its just the opacity of window ]
useAcrylic-[ to use acrylicOpacity it must be true]
icon-[ appears as favicon to window ]

(Note 1- make sure to update icon and background image to your personal liking)
(Note 2- make sure to that your defaultProfile has the guid of your powershell)

  1. Next step is to update our schemes list -

    
    
     "schemes": [
        {
            "name": "Blue Matrix",
            "black": "#101116",
            "red": "#ff5680",
            "green": "#00ff9c",
            "yellow": "#fffc58",
            "blue": "#00b0ff",
            "purple": "#d57bff",
            "cyan": "#76c1ff",
            "white": "#c7c7c7",
            "brightBlack": "#686868",
            "brightRed": "#ff6e67",
            "brightGreen": "#5ffa68",
            "brightYellow": "#fffc67",
            "brightBlue": "#6871ff",
            "brightPurple": "#d682ec",
            "brightCyan": "#60fdff",
            "brightWhite": "#ffffff",
            "background": "#1d2342",
            "foreground": "#b8ffe1"
        }
    ],
    
More themes at - [atomcorp.github.io/themes/](https://atomcorp.github.io/themes/)

That's pretty much for the windows Terminal Settings , lets move to add some cool plugins 🔥.

---

### PowerLine Setup ⚡
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/73e98cxinv28jywdxrhb.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8uejzmvkxrwkxevxohk4.png)

Edit - ⚠️ With the newer version of oh-my-posh, and significant changes from V2. this article needs update. Note that this will still work perfectly fine with V2 of oh-my-posh.

 Prerequisites - 
 - Install [Cascadia code PL](https://github.com/microsoft/cascadia-code/releases) font. (Otherwise you might some gibberish on your terminal )
 - [Git](https://git-scm.com/downloads) for windows
 - Install Posh-git and Oh-my-posh  ( use powershell )
Enter fullscreen mode Exit fullscreen mode

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

---

####  Customize your PowerShell prompt 🔨
 - Open your PowerShell profile with `notepad $PROFILE` or the text editor of your choice. This is not your Windows Terminal profile. Your PowerShell profile is a script that runs every time PowerShell starts.
 -  If your powershell doesn't already have a profile, create one -> 
Enter fullscreen mode Exit fullscreen mode
if (!(Test-Path -Path $PROFILE)) { New-Item -ItemType File -Path ROFILE -Force }
Enter fullscreen mode Exit fullscreen mode
- Now go ahead and add the following code to your powershell profile -
Enter fullscreen mode Exit fullscreen mode

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

More themes at - [ oh-my-posh themes](https://github.com/JanDeDobbeleer/oh-my-posh#themes)

( ⚠️  if your powershell gives module not found error ) add the following code with default module location, to the top of your Powershell Profile.
Enter fullscreen mode Exit fullscreen mode

$env:PSModulePath = $env:PSModulePath + "$([System.IO.Path]::PathSeparator)C:\Users\xxxx\Documents\WindowsPowerShell\Modules"

Still facing error - Visit [https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7)


---
### Modifying Oh-my-posh theme ( 🦄🔥🚀 Emojis )

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

---
Remember we set our default oh-my-posh theme to paradox, lets head over to customize it.

- Navigate to your PSmodules directory, then into oh-my-posh themes directory 
    - `Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes`

- Open Paradox file, scroll down to the bottom and update following lines -

Enter fullscreen mode Exit fullscreen mode

$sl.PromptSymbols.StartSymbol = [char]::ConvertFromUtf32(0x01F984) + [char]::ConvertFromUtf32(0x0001F525) + ' '
$sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x01F680) +[char]::ConvertFromUtf32(0x276F)

*(This lines will add cool emojis just before your StartSymbol & PromptIndicator)*

---

### Adding custom banner to your Powershell 🏳️‍🌈

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uwpi5z246kgy9ubu9i4a.png)
This is quite tedious task if you want to add complex images in the banner.
( There is easier way [Neofetch for windows](https://github.com/dylanaraps/neofetch), but it comes with its own lag overhead whenever you open your windows terminal )

- *Tedious but way less overhead* Method
    -  Change your powershell file to add your custom ascii art. 
    -  In my case, I changed my Profile Image to Ascii Art via [https://www.topster.net/ascii-generator/](https://www.topster.net/ascii-generator/).
    - Next problem is color support, by default powershell doesn't allow you to write multipler colored text on a single line.
    -  ( You could proceed without this ) If want the above function install Write color module.
    `Install-Module -Name PSWriteColor`
    - Now just below your $psenvmodule path add the following lines to display your customized banner .
Enter fullscreen mode Exit fullscreen mode

Write-Color -Text " /@ " -Color Cyan
Write-Color -Text " @(","@ " -Color Blue,Cyan
Write-Color -Text " @@/"," @* " -Color Blue, Cyan
Write-Color -Text " @#/"," @@* " -Color Blue, Cyan
Write-Color -Text " @@(/"," @@,, " -Color Blue, Cyan
Write-Color -Text " @%(/ @@","@@@@@@","@@@@ " -Color Blue, DarkCyan, Cyan
Write-Color -Text " @@#","#"," " -Color Blue, DarkCyan, Cyan
Write-Color -Text " @@##","#(((/","///",",,,,,@ " -Color Blue, DarkBlue, DarkCyan, Cyan
Write-Color -Text " @@%%#","##(((/","///
","****,,,,,,@ " -Color Blue, DarkBlue, DarkCyan, Cyan
Write-Color -Text "@@@@@W","@@@@@@","@@@@@@","@@@@@@@@@@@ " -Color Blue, DarkBlue, DarkCyan, Cyan
Write-Color -Text " "


*(Note - the number of colors you can choose from is somewhat limited: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, and White )*

Edit 1. - Your Powershell Profile should look like this - [ pastebin.com/JAX3Ce23](pastebin.com/JAX3Ce23)

Edit 2. - Background Image source - [facets.la](facets.la)

Edit 3. - With the new version of oh-my-posh, few commands (ex- set-theme ) have been depreciated. I'm planning to update the article with the specifics, till then use their documentation for updated syntax - [Repo Link](https://github.com/JanDeDobbeleer/oh-my-posh)


----

## Credits

- [Windows Terminal Community ❤](https://github.com/microsoft/terminal) 
- [https://github.com/JanDeDobbeleer/oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh)
- [https://github.com/dahlbyk/posh-git](https://github.com/dahlbyk/posh-git)
- [https://github.com/EvotecIT/PSWriteColor](https://github.com/EvotecIT/PSWriteColor)
- [https://github.com/atomcorp/themes](https://github.com/atomcorp/themes)
Enter fullscreen mode Exit fullscreen mode

Comments 56 total

  • Ben Sinclair
    Ben SinclairMay 31, 2020

    The Windows Terminal is a modern, fast, efficient, powerful, and productive terminal application

    It's modern in the sense that it's relatively recent. It's not particularly modern in terms of features.

    But as for fast... try to cat a long file in Windows Terminal or run a bunch of dir commands in a loop, and then try the same thing on a Mac or Linux machine. I tried a large file the other day, something that took 0.6 seconds on a Mac took 26 seconds on Windows. 26 seconds! That's not just slow, it's glacial. it's about 50 times slower. You can watch the screen scroll up like you're looking at a dir /w on a PC1512. It's not down to the individual machine's specs, or whether it's running WSL or anything, this is down to the way Terminal works.

    I'm sure it'll get better. But it's definitely not fast.

    • Anup Aglawe
      Anup AglaweMay 31, 2020

      Agree with you ( that's the description microsoft gave ).
      Let's hope it gets better.

    • Niko Heikkilä
      Niko HeikkiläMay 31, 2020

      I've opened a couple of large files in Windows Terminal and Vim. No performance issues on typing or scrolling whatsoever. iTerm2 on my MacBook Pro might be a bit faster.

      Real benchmarks would be helpful here. Of course, the Terminal being open-source any lagging issues would be easy to verify.

  • emadsaber
    emadsaberJun 1, 2020

    Thanks very much for your effort. I prefer something like Cmder

  • Rohit  Patil
    Rohit PatilJun 4, 2020

    Hey Anup,

    Thanks for a great guide. Can you please also share the image which you have used as the background image for the terminal?
    I liked it and want to use the same. :)

  • HappyToDev
    HappyToDevSep 19, 2020

    Hello Anup, thanks for this post.
    I have some trouble like on the screenshot here.
    Could you telle me what's wrong ?
    I precise, I already installed fonts asked in prerequisites.

    dev-to-uploads.s3.amazonaws.com/i/...

    • Anup Aglawe
      Anup AglaweSep 19, 2020
         "fontFace": "Cascadia Code PL",
      
      Enter fullscreen mode Exit fullscreen mode

      Did you add this in your settings.json?

      • HappyToDev
        HappyToDevSep 19, 2020

        I'm pretty sure ... not :D
        Thanks, I forgot this.
        It works now ! ;-)

  • HappyToDev
    HappyToDevSep 19, 2020

    If you will use this in VSCode Terminal, use by default PowerShell 7 version and don't forget to enter "Cascadia Code PL" in Terminal > Integrated: Font Family

    And enjoy !

  • 𝗗 𝗶 𝗸 𝗼
    𝗗 𝗶 𝗸 𝗼Sep 21, 2020

    Now just below your $psenvmodule path add the following lines to display your customized banner.

    where is the location?

  • zealotce
    zealotceOct 28, 2020

    hello , do you have any plan to support "anaconda env" in powershell in windows terminal.

  • Akhilesh Balaji
    Akhilesh BalajiNov 4, 2020

    Hey, this is really cool!

    I have set it up, and it was working fine. However, there seems to be some issue with the PSWRITECOLOR module. If I add too many lines that haven't returned anything, the banner gets distorted:
    Normal:

    Too many lines:

    Is there any way to fix this? Would really appreciate some help.

    Thanks in advance.

    • Anup Aglawe
      Anup AglaweNov 4, 2020

      This is wierd. I'm not sure about it either.

      I will tag you if I find the fix👍

      • Akhilesh Balaji
        Akhilesh BalajiNov 14, 2020

        It appears to be a problem with the newline character. That's what is compressing the lines above it. I disabled both of the extensions, and kept typing the command

        echo "`n"

        and the above characters got compressed, but this didn't happen when I didn't set a newline. Interesting...

      • Akhilesh Balaji
        Akhilesh BalajiNov 14, 2020

        I've finally figured it out. Just replace Set-Newline or any newline characters with Write-Color -Text " ". It works perfectly.

  • Harleq Dreamy
    Harleq DreamyNov 8, 2020

    I do get the weird symbols on my themes. And also at the banner part I don't know where to put that in. You say $psenvmodule path is where I find it. But I don't known what that means and also you say in another comment it's in powershell profile. But I do the ctrl + , and I don't find anything of the sort.

    So everything works, except I need to set theme every time I log in. I get strange symbols, I tried doing "git clone github.com/microsoft/cascadia-code..." in the powershell but nothing seems to come into effect, maybe I need to restard?
    also I don't know what to do with the banner, where to find the file how to set it up.

    • Daniela Giorgio
      Daniela GiorgioJan 16, 2021

      If you want to install the font you have to download the first zip on this page and open it github.com/microsoft/cascadia-code... then open ttf folder, double click on CascadiaCodePL and click install.
      The banner part is a bit confusing yep, my profile is at "C:\Users\YOURNAME\Documents\WindowsPowerShell"
      I easily created it by typing "notepad $PROFILE" on Windows Powershell. Then I pasted OP's profile (pastebin.com/JAX3Ce23) inside it.

  • Chris Pinkney
    Chris PinkneyNov 10, 2020

    Awesome, thanks!

    However, the transparency affects disappear when the window is not focused, any ideas how to fix this?

    • Anup Aglawe
      Anup AglaweNov 10, 2020

      From their GitHub repo

      unfortunately! System policy dictates that acrylic is only allowed on the actively focused window. Once the terminal loses focus, the system takes acrylic away from us.

      • Chris Pinkney
        Chris PinkneyNov 10, 2020

        Too bad! I tried to google it a bit before commenting and found similar answers but was hoping you'd somehow have a solution. Thank you!

  • zakialfaridzi
    zakialfaridziNov 10, 2020

    Hi! love the article. But i was wondering how to change the emojis?

    • Anup Aglawe
      Anup AglaweNov 10, 2020
      $sl.PromptSymbols.StartSymbol = [char]::ConvertFromUtf32(0x01F984) + [char]::ConvertFromUtf32(0x0001F525) + ' '
      $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x01F680) +[char]::ConvertFromUtf32(0x276F)
      
      Enter fullscreen mode Exit fullscreen mode

      The hexcodes (0x...) you see in this snippet represents emojis. Just google hex code of emojis you like and replace the above code.

  • Alfredo Narváez Docimo
    Alfredo Narváez DocimoNov 12, 2020

    This is so amazing, thank you thank you thank you!!! I thought the only way I could achieve a somewhat aesthetic terminal was using WSL and installing oh-my-zsh and whatnot. Massive thanks for real! 💙

  • Shekh Saifuddin
    Shekh SaifuddinNov 14, 2020

    How can get rid of this weird message?

    dev-to-uploads.s3.amazonaws.com/i/...

    • Anup Aglawe
      Anup AglaweNov 14, 2020

      Make sure in your settings.json ...you have -noLogo flag.
      "commandline": "powershell.exe -NoLogo -NoExit",

      • Shekh Saifuddin
        Shekh SaifuddinNov 16, 2020

        Where are the settings.json located.? I can't find this, BTW I'm using PowerShell 7.1.0
        not WindowsPowerShell

        • Anup Aglawe
          Anup AglaweNov 16, 2020

          I'm talking about windows terminal settings, which can be accessed from the terminal dropdown.

          • Shekh Saifuddin
            Shekh SaifuddinNov 16, 2020

            yah.! it's gone from Windows Terminal 😊 but still, have on PowerShell and WindowsPowerShell 😢

            • malviez
              malviezFeb 24, 2021
              1. Right click powershell shortcut
              2. Hit property
              3. Open shortcut tab
              4. Add " -nologo" at the end of target address

              The message will be gone in powershell.

  • Anup Aglawe
    Anup AglaweDec 11, 2020

    As far as I know it is not possible for cmd, but should be much easier for wsl, and there are many articles for the same.

  • batman0491
    batman0491Dec 21, 2020

    Hello,

    I'm starting out, do you have a tutorial to configure this theme?
    "Adding a custom banner to your Powershell"
    Despite my attempts I have not managed to configure it ..

  • Daniela Giorgio
    Daniela GiorgioJan 16, 2021

    thank you! I love it :)
    powershell

  • vFlag
    vFlagJan 21, 2021

    thank you so much

  • Krrish Dhaneja
    Krrish DhanejaJan 29, 2021

    can u share the pic in your terminal background?

  • Bar Lerer
    Bar LererApr 23, 2021

    How do I add emojis to Oh My Posh V3?
    When I try to edit the theme, its a JSON file, and the lines you specified are not valid JSONs

  • Adarsh Nair
    Adarsh NairApr 27, 2021

    what-a-life-what-a-meme.lifes-a-me...

    I'm getting this for some reason, any particular reason why?

  • Nicola Taddei
    Nicola TaddeiMay 6, 2021

    With new oh-my-posh version we need an article review :(.

    PS: can you share your bg wallpaper? Thank you

    • Anup Aglawe
      Anup AglaweMay 6, 2021

      Sorry but I don't have enough time to rewrite the article.

      Image source - facets.la

  • Edgar Quintero
    Edgar QuinteroMay 7, 2021

    FYI some of these commands are no longer supported, for example Set-Theme is deprecated

  • Gabriel Díaz
    Gabriel DíazMay 7, 2021

    I love it the post but i couldn't set the emojis in the prompt, i have only themes :(

    i have problem to set the paradox theme config emoji, because the file is a json and mark syntaxis error, is there someone that help me to set emoji in the prompt terminal?

    • Anup Aglawe
      Anup AglaweMay 7, 2021

      My guess would be that updated version of oh-my-posh is cause of the problem.
      As someone reported, they have depreciated set-theme command in the latest version. You could read their docs for newer syntax - github.com/JanDeDobbeleer/oh-my-posh

      Anyways, Were you able to locate and edit oh-my-posh theme configuration file to add emojis as start symbol?

      Did you add the following lines in paradox theme file?
      '
      $sl.PromptSymbols.StartSymbol = [char]::ConvertFromUtf32(0x01F984) + [char]::ConvertFromUtf32(0x0001F525) + ' '
      $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x01F680) +[char]::ConvertFromUtf32(0x276F)

      '

      • Anup Aglawe
        Anup AglaweMay 7, 2021

        Looked at their documentation, transition from V2 to v3 of oh-my-posh is quite significant.

        It would take some time for me to update the article.

  • Bao Long
    Bao LongAug 28, 2021

    Hi, for anyone have issue with "Set-Theme Paradox"
    The term 'Set-Theme' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

    see it here: github.com/microsoft/terminal/issu...

  • Nguyễn Hồng Đức
    Nguyễn Hồng ĐứcAug 28, 2023

    Is it possible to modify the Oh-my-posh theme in 2023?

Add comment