Skip to content

Instantly share code, notes, and snippets.

@JeffMill
Created April 10, 2024 22:20
Show Gist options
  • Save JeffMill/d7d97a26710c3d6d873d2a4cf4fe607e to your computer and use it in GitHub Desktop.
Save JeffMill/d7d97a26710c3d6d873d2a4cf4fe607e to your computer and use it in GitHub Desktop.
PowerShell ansi
# https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
function Write-Bold() {
param([Parameter(Mandatory)][string]$Message)
$ESC = [char]27
"$ESC[1m$Message$ESC[0m"
}
function Write-Italic() {
param([Parameter(Mandatory)][string]$Message)
$ESC = [char]27
"$ESC[3m$Message$ESC[0m"
}
function Write-Underlined() {
param([Parameter(Mandatory)][string]$Message)
$ESC = [char]27
"$ESC[4m$Message$ESC[0m"
}
function Write-Inverse() {
param([Parameter(Mandatory)][string]$Message)
$ESC = [char]27
"$ESC[7m$Message$ESC[0m"
}
Write-Bold -Message 'this is bold.'
''
Write-Italic -Message 'this is italic.'
''
Write-Underlined -Message 'this is underlined.'
''
Write-Inverse -Message 'this is inverse.'
''
'Normal.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment