-
-
Save B4Art/9456fbb2490b3e5c3a9d6dd24f32a665 to your computer and use it in GitHub Desktop.
output all the colour combinations for text/background in powershell
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
# output all the colour combinations for text/background | |
# http://stackoverflow.com/a/41954792/10245 | |
$colors = [enum]::GetValues([System.ConsoleColor]) | | |
Select-Object @{N='ColorObject';E={$_}}, | |
@{N='ColorName'; E={ | |
If ($_.ToString().substring(0,3) -eq 'Dar' ){ | |
$_.ToString().Substring(4) + 'DARK' | |
} else { | |
$_.ToString() | |
} | |
} | |
} | | |
Sort-Object Colorname | |
Foreach ($bgcolor in $colors.ColorObject){ | |
Foreach ($fgcolor in $colors.ColorObject) { Write-Host "$fgcolor|" -ForegroundColor $fgcolor -BackgroundColor $bgcolor -NoNewLine } | |
Write-Host " on $bgcolor" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment