Skip to content

StartAutomating/Escape

Escape

© 2026 Start-Automating

Escape the pain of escape sequences

Escape Sequences

Escape sequences are a nearly unavoiable part of technology.

We often need to escape strings into other formats (like putting < or > inside of HTML).

We also often need to use more obscure escape sequences to adjust terminal settings.

Escape is a collection of escape sequences, and the way to escape having to remember them.

Escape Architecture

Escape is a collection of scripts that make escape sequences.

It has a relatively simple architecture:

  • Each script resides in ./Types/Escape.Sequence.
  • All scripts are compiled into ScriptMethods by EZOut.
  • Get-Escape exposes all of these scripts with natural syntax
  • Get-Escape is aliased to escape and esc for easier-to-read syntax

Escape Contributions

While Escape has over a hundred sequences, it is nowhere near a complete collection.

To help make it a better one, please consider contributing

Installing and Importing

You can install this module from the PowerShell gallery

Install-Module Escape -Scope CurrentUser -Force

Once installed, you can import the module with:

Import-Module Escape -PassThru

You can also clone the repo and import the module locally:

git clone https://github.com/StartAutomating/Escape
cd ./Escape
Import-Module ./ -PassThru

Functions

Escape has 1 function

Get-Escape

Get Escape Sequences

Get Escape

Examples
Example 1

Bolding text

escape bold boldText reset
Example 2

Italic text

escape italic italicText reset
Example 3

Bold and italic text

escape bold italic boldAndItalic reset
Example 4

Crossed out text

escape crossout "crossed out" reset
Example 5

Using standard foreground colors

escape foregroundRed r foregroundGreen g foregroundBlue b reset
Example 6

Escape HTML content

escape html "a > b"
Example 7

Escape html attributes

escape htmlAttribute "'a' -gt 'b'"
Example 8

Escape XML content

escape xml "a > b"
Example 9

Show primary console colors

"$(
    escape underline overline
    foreach ($n in 0..15) {
        escape foregroundColor $n $n
    }
    escape reset
)"
Example 10

Display the 256 standard xterm colors

@(
    foreach ($n in 0..255) {
        "$(escape bold foregroundColor $n $n)"
    }
    escape reset
) -join "`t"
Example 11

Display the 256 standard xterm colors (using a prototype is faster than using natural syntax)

$escape = [PSCustomObject]@{PSTypeName='Escape.Sequence'}
$escape.bold()        
@(
    foreach ($n in 0..255) {
        "$($escape.foregroundColor($n)) $n"
    }
    $escape.reset()
) -join "`t"
Example 12

RGB

escape foregroundRed r foregroundGreen g foregroundBlue b reset
Example 13

RGB bold and italic

escape bold italic foregroundRed r foregroundGreen g foregroundBlue b reset
Example 14

RGB bold italic underline overline

escape underline overline bold italic foregroundRed r foregroundGreen g foregroundBlue b reset
Example 15

The Notorious RBG

escape underline overline bold italic "The Notorious " foregroundRed R foregroundBlue B foregroundGreen G reset
Example 16

Terminal Rainbow

escape @(
    "bold"
    "foregroundBrightRed", "r"
    "foregroundBrightYellow", "a"
    "foregroundYellow", "i"
    "foregroundGreen", "n"
    "foregroundBlue", "b"
    "foregroundBrightPurple", "o"
    "foregroundPurple", "w"
    "reset"        
)
Example 17

Terminal Reading Rainbow

@(
    "Reading "
    "bold"
    "foregroundBrightRed", "R"
    "foregroundBrightYellow", "a"
    "foregroundYellow", "i"
    "foregroundGreen", "n"
    "foregroundBlue", "b"
    "foregroundBrightPurple", "o"
    "foregroundPurple", "w"        
    "reset"
) | escape
Example 18

Escape Konami Code (will not do anything in any terminal, just having fun)

escape @(
    'cursorUp',1 ,'cursorUp',1
    'cursorDown', 1, 'cursorDown', 1
    'cursorBackward', 1, 'cursorForward',1
    'cursorBackward', 1, 'cursorForward',1
    'b'
    'a'
    'start'
)

Types

Escape.Sequence

Members

Name MemberType
alternativeFont ScriptMethod
auxOff ScriptMethod
auxOn ScriptMethod
backgroundBlack ScriptMethod
backgroundBlue ScriptMethod
backgroundBrightBlack ScriptMethod
backgroundBrightBlue ScriptMethod
backgroundBrightCyan ScriptMethod
backgroundBrightGreen ScriptMethod
backgroundBrightPurple ScriptMethod
backgroundBrightRed ScriptMethod
backgroundBrightWhite ScriptMethod
backgroundBrightYellow ScriptMethod
backgroundColor ScriptMethod
backgroundCyan ScriptMethod
backgroundDefault ScriptMethod
backgroundGreen ScriptMethod
backgroundPurple ScriptMethod
backgroundRed ScriptMethod
backgroundWhite ScriptMethod
backgroundYellow ScriptMethod
blink ScriptMethod
blinkOff ScriptMethod
bold ScriptMethod
clearLine ScriptMethod
clearScreen ScriptMethod
clearScreenDeleteScrollback ScriptMethod
clearToLineEnd ScriptMethod
clearToLineStart ScriptMethod
clearToScreenEnd ScriptMethod
clearToScreenStart ScriptMethod
conceal ScriptMethod
crossout ScriptMethod
crossoutOff ScriptMethod
cursorAbsoluteLine ScriptMethod
cursorBackward ScriptMethod
cursorBlinkOff ScriptMethod
cursorBlinkOn ScriptMethod
cursorDown ScriptMethod
cursorForward ScriptMethod
cursorHide ScriptMethod
cursorNextLine ScriptMethod
cursorPreviousLine ScriptMethod
cursorRestore ScriptMethod
cursorSave ScriptMethod
cursorShapeBar ScriptMethod
cursorShapeBlinkingBar ScriptMethod
cursorShapeBlinkingBlock ScriptMethod
cursorShapeBlinkingUnderline ScriptMethod
cursorShapeBlock ScriptMethod
cursorShapeDefault ScriptMethod
cursorShapeUnderline ScriptMethod
cursorShow ScriptMethod
cursorUp ScriptMethod
disableAlternateScreenBuffer ScriptMethod
disableReportingFocus ScriptMethod
doubleUnderline ScriptMethod
enableAlternateScreenBuffer ScriptMethod
enableReportingFocus ScriptMethod
encircled ScriptMethod
enterLineDrawMode ScriptMethod
exitLineDrawMode ScriptMethod
foregroundBlack ScriptMethod
foregroundBlue ScriptMethod
foregroundBrightBlack ScriptMethod
foregroundBrightBlue ScriptMethod
foregroundBrightCyan ScriptMethod
foregroundBrightGreen ScriptMethod
foregroundBrightPurple ScriptMethod
foregroundBrightRed ScriptMethod
foregroundBrightWhite ScriptMethod
foregroundBrightYellow ScriptMethod
foregroundColor ScriptMethod
foregroundCyan ScriptMethod
foregroundDefault ScriptMethod
foregroundGreen ScriptMethod
foregroundPurple ScriptMethod
foregroundRed ScriptMethod
foregroundWhite ScriptMethod
foregroundYellow ScriptMethod
framed ScriptMethod
html ScriptMethod
htmlAttribute ScriptMethod
hyperlink ScriptMethod
ideogramDoubleOverline ScriptMethod
ideogramDoubleUnderline ScriptMethod
ideogramOverline ScriptMethod
ideogramReset ScriptMethod
ideogramStress ScriptMethod
ideogramUnderline ScriptMethod
italic ScriptMethod
italicOff ScriptMethod
lastLine ScriptMethod
musicNote ScriptMethod
nextLine ScriptMethod
normalIntensity ScriptMethod
normalscript ScriptMethod
notFramed ScriptMethod
overline ScriptMethod
overlineOff ScriptMethod
proportionalSpacing ScriptMethod
proportionalSpacingOff ScriptMethod
reset ScriptMethod
reveal ScriptMethod
reverse ScriptMethod
reverseOff ScriptMethod
screenAlignmentPattern ScriptMethod
scrollDown ScriptMethod
scrollUp ScriptMethod
setColor ScriptMethod
setTabBackgroundColor ScriptMethod
setTabForegroundColor ScriptMethod
subscript ScriptMethod
superscript ScriptMethod
underline ScriptMethod
underlineColor ScriptMethod
underlineDefault ScriptMethod
underlineOff ScriptMethod
xml ScriptMethod

About

Escape the pain of escape sequences

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors