Author: Malte Bublitz
Language/File type: PowerShell
Description
ANSI Escape codes for colored output and attributes (bold/italic/underline).
Based on https://github.com/malte70/dotfiles/blob/master/.zsh/ansi.zsh
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ESC = [char]27
New-Variable -Name "ANSI_RESET" -Value "$ESC[0m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_ATTR_BOLD" -Value "$ESC[1m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_ATTR_ITALIC" -Value "$ESC[3m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_ATTR_UNDERLINE" -Value "$ESC[4m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_BLACK" -Value "$ESC[0;30m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_RED" -Value "$ESC[0;31m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_GREEN" -Value "$ESC[0;32m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_YELLOW" -Value "$ESC[0;33m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_BLUE" -Value "$ESC[0;34m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_DARK_MAGENTA" -Value "$ESC[0;35m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_DARK_CYAN" -Value "$ESC[0;36m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_GREY" -Value "$ESC[0;37m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_DARK_GREY" -Value "$ESC[1;30m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_LIGHT_RED" -Value "$ESC[1;31m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_LIGHT_GREEN" -Value "$ESC[1;32m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_LIGHT_YELLOW" -Value "$ESC[1;33m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_LIGHT_BLUE" -Value "$ESC[1;34m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_MAGENTA" -Value "$ESC[1;35m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_CYAN" -Value "$ESC[1;36m" -Option ReadOnly -Scope "Global"
New-Variable -Name "ANSI_COLOR_WHITE" -Value "$ESC[1;37m" -Option ReadOnly -Scope "Global"