/PSColorizer

PowerShell module for color formatting of console output.

Primary LanguagePowerShellMIT LicenseMIT

PSColorizer

Logo

Makes your console output finally look good

Installation

Install-Module PSColorizer

Usage

Import module

using module PSColorizer
# OR
Import-Module PSColorizer

Write into console

Write-Colorized is the comandlet exported from this module. It outputs messages using Console.WriteLine method, using certain grammar to format these messages.

Colors are set using the <color>message</color> notation.

Let's imagine you want message to appear violet in user's console:

<magenta>Hello world!</magenta>

readme-example-1

You can use any string which can be converted to the type System.ConsoleColor. Wrong color name will throw an error:

readme-example-2

Since module uses single regular expression to extract color tags, without any sort of actual parsing, nested color tags are not supported:

readme-example-3

In that case, desired behaviour can be achieved by using tags in sequence:

readme-example-3.1

You can specify default color which will be used outside of color tags:

readme-example-4