Last active
October 24, 2020 07:48
-
-
Save grokk-it/8d49e6e2445a93276275a9d87c45b81f to your computer and use it in GitHub Desktop.
PowerShell ANSI 256-color chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 256-Color Foreground & Background Charts | |
$esc=$([char]27) | |
echo "`n$esc[1;4m256-Color Foreground & Background Charts$esc[0m" | |
foreach ($fgbg in 38,48) { # foreground/background switch | |
foreach ($color in 0..255) { # color range | |
#Display the colors | |
$field = "$color".PadLeft(4) # pad the chart boxes with spaces | |
Write-Host -NoNewLine "$esc[$fgbg;5;${color}m$field $esc[0m" | |
#Display 6 colors per line | |
if ( (($color+1)%6) -eq 4 ) { echo "`r" } | |
} | |
echo `n | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment