PSReadLine for Light Mode Terminals

Saturday, January 2, 2021

Over holiday break, I took the opportunity to rebuild my aging 2015 MacBook Air. As part of that, I installed PowerShell Core (to run the AZ PowerShell module, naturally) and the default color scheme for psreadline on MacOS is… awful.

I mean, yellow on white isn’t legible on the best of days. As I finished up the reinstall, I decided I wanted a PowerShell color scheme that matched the Material Theme for iTerm 2. Looking at the color values in that theme, I came up with the following that can be added to the PowerShell profile (and easily adjusted to a different color scheme if you’d prefer).

$materialblack = "#2c2c2c"
$materialbrightblack = "#535353"
$materialred = "#c62727"
$materialbrightred = "#ef524f"
$materialgreen = "#558b2e"
$materialbrightgreen = "#8bc249"
$materialyellow = "#f9a824"
$materialbrightyellow =  "#ffea3a"
$materialblue = "#1564bf"
$materialbrightblue = "#64b5f6"
$materialmagenta = "#691e99"
$materialbrightmagenta = "#ba67c8"
$materialcyan = "#00828e"
$materialbrightcyan = "#26c6da"
$materialwhite = "#f2f2f2"
$materialbrightwhite = "#e0e0e0"

Set-PSReadLineOption -Colors @{
 "Command"    = $materialyellow
 "Number"    = $materialbrightblue
 "Member"    = $materialbrightmagenta
 "Operator"    = $materialbrightcyan
 "Type"     = $materialbrightblack
 "Variable"    = $materialgreen
 "Parameter"    = $materialgreen
 "ContinuationPrompt" = $materialbrightblack
 "Default"     = $materialbrightblack
}

That configuration gets you the following colors in the terminal - please note, this only works on terminals other than the default MacOS terminal due to its lack of color support.

powershellmacos

Managing Python Versions on Windows with pyenv-win

Azure Files for Linux - Shared Non-Root Access

comments powered by Disqus