diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index 518df25e4982..08df65320cbc 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -1,7 +1,7 @@ --- description: Describes the features of PowerShell that use ANSI escape sequences and the terminal hosts that support them. Locale: en-US -ms.date: 08/27/2024 +ms.date: 12/09/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_ansi_terminals?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_ANSI_Terminals @@ -183,8 +183,23 @@ The following members control how or when ANSI formatting is used: - **SymbolicLink** - Built-in member to specify color for symbolic links - **Executable** - Built-in member to specify color for executables. - **Extension** - Use this member to define colors for different file - extensions. The **Extension** member pre-includes extensions for archive - and PowerShell files. + extensions. The **Extension** member predefines colors for archive and + PowerShell file extensions. + + The following example shows how to change the colors for various `FileInfo` + settings and specific file extensions. The colors are chosen to work well + on a light terminal background. + + ```powershell + $PSStyle.FileInfo.Directory = $PSStyle.Background.FromRgb(0x2f6aff) + + $PSStyle.Foreground.BrightWhite + $PSStyle.FileInfo.SymbolicLink = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Executable = $PSStyle.Foreground.BrightMagenta + $PSStyle.FileInfo.Extension['.ps1'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.ps1xml'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.psd1'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.psm1'] = $PSStyle.Foreground.Cyan + ``` ## Cmdlets that generate ANSI output diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index 1f14086eec98..340b72d8d647 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -1,7 +1,7 @@ --- description: Describes the features of PowerShell that use ANSI escape sequences and the terminal hosts that support them. Locale: en-US -ms.date: 08/27/2024 +ms.date: 12/09/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_ansi_terminals?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_ANSI_Terminals @@ -183,8 +183,23 @@ The following members control how or when ANSI formatting is used: - **SymbolicLink** - Built-in member to specify color for symbolic links - **Executable** - Built-in member to specify color for executables. - **Extension** - Use this member to define colors for different file - extensions. The **Extension** member pre-includes extensions for archive - and PowerShell files. + extensions. The **Extension** member predefines colors for archive and + PowerShell file extensions. + + The following example shows how to change the colors for various `FileInfo` + settings and specific file extensions. The colors are chosen to work well + on a light terminal background. + + ```powershell + $PSStyle.FileInfo.Directory = $PSStyle.Background.FromRgb(0x2f6aff) + + $PSStyle.Foreground.BrightWhite + $PSStyle.FileInfo.SymbolicLink = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Executable = $PSStyle.Foreground.BrightMagenta + $PSStyle.FileInfo.Extension['.ps1'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.ps1xml'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.psd1'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.psm1'] = $PSStyle.Foreground.Cyan + ``` ## Cmdlets that generate ANSI output diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index ff49488a51db..0d5c9faf24b3 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -1,7 +1,7 @@ --- description: Describes the features of PowerShell that use ANSI escape sequences and the terminal hosts that support them. Locale: en-US -ms.date: 08/27/2024 +ms.date: 12/09/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_ansi_terminals?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_ANSI_Terminals @@ -183,8 +183,23 @@ The following members control how or when ANSI formatting is used: - **SymbolicLink** - Built-in member to specify color for symbolic links - **Executable** - Built-in member to specify color for executables. - **Extension** - Use this member to define colors for different file - extensions. The **Extension** member pre-includes extensions for archive - and PowerShell files. + extensions. The **Extension** member predefines colors for archive and + PowerShell file extensions. + + The following example shows how to change the colors for various `FileInfo` + settings and specific file extensions. The colors are chosen to work well + on a light terminal background. + + ```powershell + $PSStyle.FileInfo.Directory = $PSStyle.Background.FromRgb(0x2f6aff) + + $PSStyle.Foreground.BrightWhite + $PSStyle.FileInfo.SymbolicLink = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Executable = $PSStyle.Foreground.BrightMagenta + $PSStyle.FileInfo.Extension['.ps1'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.ps1xml'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.psd1'] = $PSStyle.Foreground.Cyan + $PSStyle.FileInfo.Extension['.psm1'] = $PSStyle.Foreground.Cyan + ``` ## Cmdlets that generate ANSI output diff --git a/reference/docs-conceptual/learn/shell/using-light-theme.md b/reference/docs-conceptual/learn/shell/using-light-theme.md index 7ead6f46f96d..6264f38804c0 100644 --- a/reference/docs-conceptual/learn/shell/using-light-theme.md +++ b/reference/docs-conceptual/learn/shell/using-light-theme.md @@ -1,7 +1,7 @@ --- description: > This article shows how to configure PSReadLine color settings for a light themed terminal. -ms.date: 11/21/2025 +ms.date: 12/09/2025 title: Configuring a light colored theme --- # Configuring a light colored theme @@ -11,6 +11,14 @@ terminal. However, some users might choose to use a light background with dark t the default colors don't set the background, using light foreground colors on a light background produces unreadable text. +Beginning in PowerShell 7.2, PowerShell adds colorized output to the default console experience. The +`$PSStyle` feature is not natively available in Windows PowerShell. However, using the [PSStyle][05] +module from the PowerShell Gallery, you can set color values using these same techniques described +in this article. + +The colors used are defined in the `$PSStyle` variable and are designed for a dark background. You +can change these colors to work better for a light background terminal. + **PSReadLine** allows you to define colors for 18 different syntax elements. You can view the current settings using the `Get-PSReadLineOption` cmdlet. @@ -96,13 +104,9 @@ $ISETheme = @{ ``` > [!NOTE] -> In PowerShell 7.2 and higher you can use the `FromRGB()` method of `$PSStyle` to create the ANSI -> escape sequences for the colors you want. -> -> For more information about `$PSStyle`, see [about_ANSI_Terminals][01]. -> -> For more information about ANSI escape sequences, see the [ANSI escape code][04] article in -> Wikipedia. +> You can use the `FromRGB()` method to create the ANSI escape sequences for the colors you want. +> For more information about `$PSStyle`, see [about_ANSI_Terminals][01]. For more information about +> ANSI escape sequences, see the [ANSI escape code][04] article in Wikipedia. ## Setting the color theme in your profile @@ -116,27 +120,25 @@ Add the `$ISETheme` variable and the following `Set-PSReadLineOption` command to Set-PSReadLineOption -Colors $ISETheme ``` -Beginning in PowerShell 7.2, PowerShell adds colorized output to the default console experience. The -colors used are defined in the `$PSStyle` variable and are designed for a dark background. The -following settings work better for a light background terminal. +The following settings work better for a light background terminal. ```powershell -$PSStyle.Formatting.FormatAccent = "`e[32m" -$PSStyle.Formatting.TableHeader = "`e[32m" -$PSStyle.Formatting.ErrorAccent = "`e[36m" -$PSStyle.Formatting.Error = "`e[31m" -$PSStyle.Formatting.Warning = "`e[33m" -$PSStyle.Formatting.Verbose = "`e[33m" -$PSStyle.Formatting.Debug = "`e[33m" -$PSStyle.Progress.Style = "`e[33m" +$PSStyle.Formatting.FormatAccent = $PSStyle.Foreground.Green +$PSStyle.Formatting.TableHeader = $PSStyle.Foreground.Green +$PSStyle.Formatting.ErrorAccent = $PSStyle.Foreground.Cyan +$PSStyle.Formatting.Error = $PSStyle.Foreground.Red +$PSStyle.Formatting.Warning = $PSStyle.Foreground.Yellow +$PSStyle.Formatting.Verbose = $PSStyle.Foreground.Yellow +$PSStyle.Formatting.Debug = $PSStyle.Foreground.Yellow +$PSStyle.Progress.Style = $PSStyle.Foreground.Yellow $PSStyle.FileInfo.Directory = $PSStyle.Background.FromRgb(0x2f6aff) + $PSStyle.Foreground.BrightWhite -$PSStyle.FileInfo.SymbolicLink = "`e[36m" -$PSStyle.FileInfo.Executable = "`e[95m" -$PSStyle.FileInfo.Extension['.ps1'] = "`e[36m" -$PSStyle.FileInfo.Extension['.ps1xml'] = "`e[36m" -$PSStyle.FileInfo.Extension['.psd1'] = "`e[36m" -$PSStyle.FileInfo.Extension['.psm1'] = "`e[36m" +$PSStyle.FileInfo.SymbolicLink = $PSStyle.Foreground.Cyan +$PSStyle.FileInfo.Executable = $PSStyle.Foreground.BrightMagenta +$PSStyle.FileInfo.Extension['.ps1'] = $PSStyle.Foreground.Cyan +$PSStyle.FileInfo.Extension['.ps1xml'] = $PSStyle.Foreground.Cyan +$PSStyle.FileInfo.Extension['.psd1'] = $PSStyle.Foreground.Cyan +$PSStyle.FileInfo.Extension['.psm1'] = $PSStyle.Foreground.Cyan ``` ## Choosing colors for accessibility @@ -144,10 +146,10 @@ $PSStyle.FileInfo.Extension['.psm1'] = "`e[36m" The ISE color theme might not work for users with color-blindness or other conditions that limit their ability to see colors. -The [World Wide Web Consortium (W3C)][05] has recommendations for using colors for accessibility. +The [World Wide Web Consortium (W3C)][06] has recommendations for using colors for accessibility. The Web Content Accessibility Guidelines (WCAG) 2.1 recommends that "visual presentation of text and images of text has a contrast ratio of at least 4.5:1." For more information, see -[Success Criterion 1.4.3 Contrast (Minimum)][06]. +[Success Criterion 1.4.3 Contrast (Minimum)][07]. The [Contrast Ratio][03] website provides a tool that lets you pick foreground and background colors and measure the contrast. You can use this tool to find color combinations that work best for @@ -158,5 +160,6 @@ you. [02]: creating-profiles.md [03]: https://contrast-ratio.com/ [04]: https://en.wikipedia.org/wiki/ANSI_escape_code -[05]: https://www.w3.org/ -[06]: https://www.w3.org/TR/WCAG/#contrast-minimum +[05]: https://www.powershellgallery.com/packages/PSStyle +[06]: https://www.w3.org/ +[07]: https://www.w3.org/TR/WCAG/#contrast-minimum