Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scottmckendry/ps-color-scripts

🌈 Port of Derek Taylor's Popular "shell-color-scripts" for PowerShell
https://github.com/scottmckendry/ps-color-scripts

color-scripts powershell powershell-module windows-terminal

Last synced: about 2 months ago
JSON representation

🌈 Port of Derek Taylor's Popular "shell-color-scripts" for PowerShell

Awesome Lists containing this project

README

        

# 🌈 PowerShell Color Scripts

An _almost_ like for like port of Derek Taylor's Popular [shell-color-scripts](https://gitlab.com/dwt1/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](https://github.com/scottmckendry/ps-color-scripts/assets/39483124/3b1edc7b-6d71-4bcd-92c4-b9ca6f1bc8b9)

## 📦 Installation

The module is available on the [PowerShell Gallery](https://www.powershellgallery.com/packages/ps-color-scripts/) and can be installed using the following command.

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

## 🚀 Usage

**Default**: Display a random color script.

```powershell
Show-ColorScript
```

**Specific**: Display a specific color script.

```powershell
Show-ColorScript -Name "pacman"
```

**List**: List all available color scripts.

```powershell
Show-ColorScript -List
```

## 🧑‍🍳 Recipes

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

![image](https://github.com/scottmckendry/ps-color-scripts/assets/39483124/7cd6a8a3-94bb-4e1b-801d-926568b82e9d)

```powershell
$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.

```powershell
$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](https://gitlab.com/dwt1/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](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) for more information).

## 📝 License

Like its inspiration, this project is licensed under the [MIT License](https://github.com/scottmckendry/ps-color-scripts/blob/main/LICENSE). Feel free to use the code as you see fit.