$PSStyle

noun

say it: “PEE ESS STYL” /ˌpiˌɛs ˈstaɪl/

A PowerShell variable holding named colors and text styles, used to color the text a command prints.

What is $PSStyle?

$PSStyle holds PowerShell 7's color and style codes by name, so you can color text without remembering escape codes. Put one in double-quoted text with $( ), and end with $PSStyle.Reset, or the color keeps going. Windows PowerShell 5.1 doesn't have it.

"$($PSStyle.Foreground.Cyan)day-3-lake$($PSStyle.Reset)> "

In a sentence

  • “Ending with $PSStyle.Reset stopped the color from spreading to everything typed after it.”
  • “Sam used $PSStyle to make the folder's name bold cyan in his prompt.”

Level: Journeyman · More PowerShell terms at this level

Updated