๐ŸŒˆ PowerShell Color Scripts

January 12, 2024 ยท View on GitHub

An almost like for like port of Derek Taylor's Popular shell-color-scripts package for PowerShell.

Painstakingly ported to PowerShell from the original Bash scripts, this module provides a collection of color scripts to brighten up your PowerShell terminal.

demo

๐Ÿ“ฆ Installation

The module is available on the PowerShell Gallery and can be installed using the following command.

Install-Module -Name ps-color-scripts -Scope CurrentUser

๐Ÿš€ Usage

Default: Display a random color script.

Show-ColorScript

Specific: Display a specific color script.

Show-ColorScript -Name "pacman"

List: List all available color scripts.

Show-ColorScript -List

๐Ÿง‘โ€๐Ÿณ Recipes

Add to your PowerShell profile to display a random color script on startup.

image

$profilePath = $PROFILE.CurrentUserAllHosts
$profileExists = Test-Path -Path $profilePath

if (!$profileExists) {
    New-Item -Path $PROFILE.CurrentUserAllHosts -ItemType File
}

Add-Content -Path $profilePath -Value "Show-ColorScript"

Tip

Replace Show-ColorScript with Show-ColorScript -Name "[name]" to display a specific color script, replacing [name] with the name of the color script you wish to display.

Add an alias for Show-ColorScript to your PowerShell profile.

Quickly display a random color script by typing scs into your PowerShell terminal.

$profilePath = $PROFILE.CurrentUserAllHosts
$profileExists = Test-Path -Path $profilePath

if (!$profileExists) {
    New-Item -Path $PROFILE.CurrentUserAllHosts -ItemType File
}

Add-Content -Path $profilePath -Value "New-Alias -Name scs -Value Show-ColorScript"

Tip

Replace scs with your preferred alias. You can also run scs [name] to display a specific color script, replacing [name] with the name of the color script you wish to display.

๐Ÿค Contributing

Contributions, issues and feature requests are welcome! Try to keep contributions in the spirit of the original shell-color-scripts project. New scripts should use ANSI escape codes to colorize the output, ideally using 10 to 16 of the available colors (see ANSI escape code for more information).

๐Ÿ“ License

Like its inspiration, this project is licensed under the MIT License. Feel free to use the code as you see fit.