Tune Powershell with OhMyPosh and ColorLS

Artem Deikun
FED is love — Front-End
6 min readFeb 8, 2024

--

Welcome to a journey of transforming the default Powershell interface into a vibrant, comfortable, and highly functional Terminal. In this article, I’ll guide you through enhancing your Powershell experience with OhMyPosh and ColorLS.

Together, we’ll turn a standard command-line interface into a visually appealing and efficient workspace.

My goal is to help you create a Terminal that is not only user-friendly but also a delight to work with. Let’s embark on this adventure to elevate your command-line game!

Before (Default)

The default Powershell interface is functional but plain, missing the visual appeal and advanced features of modern terminals. Its basic layout, limited color differentiation, and minimal customization options make for an uninspiring and impersonal user experience.

After (Windows Terminal + Font + OhMyPosh)

Transforming Powershell with Windows Terminal, a carefully selected font, and OhMyPosh elevates it from a mere tool to a workspace you’ll eagerly engage with. This integration offers a visually appealing and superior functional terminal, enriching it with detailed insights about your operating system and environment. You’ll notice enhanced information in outputs, but most importantly, the experience becomes cozy and personalized, making your work environment not only more informative but also a pleasure to use.

Quick Start Guide (For Those Who Don’t Want to Read a Long Article)

winget install "Windows Terminal" --source=winget
wt
winget install "JanDeDobbeleer.OhMyPosh"
oh-my-posh init pwsh | Invoke-Expression
New-Item -Path $PROFILE -Type File -Force
Install-Module PsReadLine -Force -Scope CurrentUser
notepad $PROFILE
# Add OhMyPosh init commands in Notepad
oh-my-posh font install
Install-Module -Name Terminal-Icons -Repository PSGallery
Install-Module -Name PowerColorLS -Repository PSGallery
notepad $PROFILE
# Add function and alias for PowerColorLS
. $PROFILE

Customize Windows Terminal Settings

  • Set Color Scheme
  • Set Icon for Tab
  • Set Background and Opacity
  • Set Rendering Engine to AtlasEngine
  • Set Cursor Style to Underscore

Install Windows Terminal

Windows Terminal is a modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells. It includes many of the features most frequently requested by the Windows command-line community, including tabs, a rich text, globalization support, and more.

winget install "Windows Terminal" --source=winget

Install OhMyPosh

While Windows Terminal offers a robust platform for customization including tabs, backgrounds, and transparency settings, the actual shell experience is elevated through OhMyPosh. It offers a plethora of themes and customization options that bring life and functionality to the terminal.

  • Run Windows Terminal
  • Install OhMyPosh
  • Run OhMyPosh
wt
winget install "JanDeDobbeleer.OhMyPosh"
oh-my-posh init pwsh | Invoke-Expression

You will see a noticeable difference, but it’s just the beginning.

To fully harness the power of OhMyPosh, there are a few more steps:

  • Ensuring it runs on each new PowerShell session.
  • Selecting and applying a theme that suits your taste.
  • Addressing font issues to ensure proper display of icons.

Fonts Installation

Windows 11 comes with decent monospaced fonts like “Consolas,” but they fall short in supporting icons and symbols, crucial for a rich terminal experience. A popular choice recommended by OhMyPosh is the “Meslo LGM NF” font.

Font Installation Option #1:

Manual download and installation process:

Font Installation Option #2:

Automated installation via OhMyPosh::

oh-my-posh font install

Terminal Settings:

Once installed, set your terminal to use the “MesloLGL Nerd Font.”

The result is a significantly enhanced visual appeal:

Create PowerShell profile file and setup on load

A PowerShell profile file allows you to customize your session with personalized scripts and commands that run every time you start a new session.

New-Item -Path $PROFILE -Type File -Force
Install-Module PsReadLine -Force -Scope CurrentUser
notepad $PROFILE

Edit the profile file in Notepad to include:

 oh-my-posh init pwsh -- config 'https://gist.githubusercontent.com/artemhp/ec9e107654695b597b20d6c9d926b98c/raw/dd1f066e3c900192fa35e103040205285444afb8/ohmyposh-theme.json' | Invoke-Expression

Result:

After these changes, your PowerShell will be significantly more user-friendly and visually appealing. The custom theme and settings in your profile bring a fresh and efficient interface to your daily tasks. Commands like ‘ls’ will now yield more detailed and visually structured outputs, enhancing your productivity and overall experience with the Terminal.

Install ColorLS

For developers and power users, the ‘ls’ command is indispensable.

To enhance its output, we introduce PowerColorLS, which builds upon the ColorLS Ruby script.

Note: Administrator permissions are recommended for installation, but you can use -- scope CurrentUser if you don’t have admin rights.

Install-Module -Name Terminal-Icons -Repository PSGallery
Install-Module -Name PowerColorLS -Repository PSGallery

The enhanced ‘ls’ command now looks like this:

PowerColorLS -l

To make the command more accessible, we’ll create a shorter alias and add useful flags in the PowerShell profile.

Edit PowerShell Profile for Alias:

notepad $PROFILE

Add to the profile:

function PowerColorLSWithOptions {
PowerColorLS -a -l --show-directory-size
}
Set-Alias -Name pls -Value PowerColorLSWithOptions

After updating the profile, either start a new session or run:

. $PROFILE

Now, the enhanced ‘ls’ command is just a pls away.

In conclusion, this enhancement to the ‘ls’ command brings a new level of clarity and efficiency to file directory navigation in PowerShell. It’s a perfect example of how a few thoughtful tweaks can significantly improve the overall experience of a command-line interface.

Adjust Windows Terminal styles

Now that we’ve enhanced the functionality of our PowerShell environment, it’s time to focus on the aesthetics and performance of the Windows Terminal itself.

Set Color Scheme

Customizing the color scheme of your terminal can significantly improve readability and aesthetics.

Set Icon for Tab:

Personalize your tabs with custom icons for quick identification.

Set Background:

Add personality to your terminal with a custom background. Adjusting the opacity.

Set Rendering Engine:

Optimize performance and appearance by selecting the right rendering engine.

Set cursor

Customize your cursor to your liking for better visibility and aesthetics.

Final Look:

The culmination of these customizations results in a highly personalized, functional, and visually appealing terminal.

Summary

Through these adjustments, we’ve transformed the Windows Terminal into a space that’s not only functional but also a true reflection of your personal style and preferences.

With these changes, your terminal is no longer just a tool — it’s a customized environment where functionality meets personal design.

--

--