PSWriteColorEX
1.1.0
Colored and styled console output for PowerShell: TrueColor (24-bit RGB), ANSI 256 and 16 colors, gradients, text styles, style profiles, padding that counts wide characters, and logging to a file. Pure PowerShell, for Windows PowerShell 5.1 and PowerShell 7 on Windows, Linux and macOS.
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) 2024 MarkusMcNugen. All rights reserved.
Package Details
Author(s)
- MarkusMcNugen
Tags
Console Color Colour ANSI Terminal Output Formatting Logging TrueColor RGB CrossPlatform Windows Linux macOS
Functions
Write-ColorEX Write-ColorError Write-ColorWarning Write-ColorInfo Write-ColorSuccess Write-ColorCritical Write-ColorDebug Set-ColorDefault Get-ColorProfiles New-ColorStyle Test-AnsiSupport Convert-HexToRGB Convert-RGBToANSI8 Convert-RGBToANSI4 Get-ColorTableWithRGB Measure-DisplayWidth Get-LighterRGBColor Get-LighterColorName Get-LighterANSI8Color
PSEditions
Dependencies
This module has no dependencies.
Release Notes
1.1.0
Fixed:
- A transcript (Start-Transcript) records each line as one line, with no blank line after it, and as many blank lines as -LinesBefore and -LinesAfter ask for (issue #2). In Windows PowerShell 5.1 a line of several console colors is still one transcript line per color, as PowerShell records each Write-Host call.
- Every string piped to Write-ColorEX or a Write-Color* helper is written; only the last one was before.
- -LogFile given as a file name alone goes in the calling script's folder, or the current location at the prompt; it went in the module's own folder before. A missing log folder is created.
- -BlankLine works with output redirected, -BackGroundColor 'None' works, -Gradient alone draws the gradient, -Color 0 is black, -Style 'Bold' alone styles the first segment, and text without -Color takes the terminal's default color.
- A gradient keeps emoji whole: each character a terminal draws takes one color.
- Hex colors work without -TrueColor, color names such as Orange keep working after a call without a color mode, and -Bold keeps White text white.
- -ANSI8 color numbers take the nearest of the 16 colors on a 16-color terminal, and -ANSI4 and -ANSI8 numbers the nearest console color where the terminal has no ANSI support.
- [PSColorStyle] can be used after Import-Module, and a change to a style profile applies to its next use.
Changed:
- On PowerShell 7.2 and later, where escape codes reach the screen, each line goes to the host in one Write-Host call.
- Log files are UTF-8 without a byte order mark by default, and each -Encoding name writes the same bytes in Windows PowerShell 5.1 and PowerShell 7.
- Measure-DisplayWidth uses the table of the Rust crate unicode-width 0.2.2 and the emoji sequence rules terminals follow, with the same widths in 5.1 and 7. Characters such as a filled circle and box drawing are 1 cell, 2 with -AmbiguousAsWide.
- Importing the module prints nothing.
- Lighten-RGBColor, Lighten-ColorName and Lighten-ANSI8Color are Get-LighterRGBColor, Get-LighterColorName and Get-LighterANSI8Color, with the old names as aliases.
Added:
- TERM=dumb turns colors off, Windows Terminal under WSL is detected as TrueColor, and -Encoding takes utf8BOM, utf8NoBOM, bigendianutf32 and ansi.
The full list is in CHANGELOG.md: https://github.com/MarkusMcNugen/PSWriteColorEX/blob/main/CHANGELOG.md
FileList
- PSWriteColorEX.nuspec
- CHANGELOG.md
- PSWriteColorEX.psd1
- README.md
- Docs\color-reference-section.md
- Examples\01-BasicUsage.ps1
- Examples\03-ANSI8Examples.ps1
- Private\ColorHost.ps1
- Private\Get-ColorHelperParams.ps1
- Public\Convert-ColorValue.ps1
- Public\Test-AnsiSupport.ps1
- Public\Write-ColorHelpers.ps1
- Tests\README.md
- Tests\Tests-ConvertColorValue.ps1
- Tests\Tests-NewGradientColorArray.ps1
- Tests\Tests-TestAnsiSupport.ps1
- Tests\Tests-WriteColorEXAutoPad.ps1
- Tests\Tests-WriteColorHelpers.ps1
- Docs\Public\Color-Conversions.md
- Docs\Public\Measure-DisplayWidth.md
- Docs\Public\PSColorStyle-Class.md
- Docs\Public\Test-AnsiSupport.md
- Docs\Public\Write-ColorDebug.md
- Docs\Public\Write-ColorEX.md
- Docs\Public\Write-ColorSuccess.md
- LICENSE
- PSWriteColorEX.psm1
- Classes\PSColorStyle.ps1
- Docs\README.md
- Examples\02-ANSI4Examples.ps1
- Examples\04-ANSI24Examples.ps1
- Private\DisplayWidthTable.ps1
- Private\New-GradientColorArray.ps1
- Public\Measure-DisplayWidth.ps1
- Public\Write-ColorEX.ps1
- Tests\Analyze-Coverage.ps1
- Tests\Tests-All.ps1
- Tests\Tests-MeasureDisplayWidth.ps1
- Tests\Tests-PSColorStyle.ps1
- Tests\Tests-WriteColorEX.ps1
- Tests\Tests-WriteColorEXOutput.ps1
- Docs\Private\New-GradientColorArray.md
- Docs\Public\Get-ColorProfiles.md
- Docs\Public\New-ColorStyle.md
- Docs\Public\Set-ColorDefault.md
- Docs\Public\Write-ColorCritical.md
- Docs\Public\Write-ColorError.md
- Docs\Public\Write-ColorInfo.md
- Docs\Public\Write-ColorWarning.md
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.1.0 (current version) | 5 | 10/6/2026 |