Escape.types.ps1xml
|
<!-- Generated with EZOut 2.0.6: Install-Module EZOut or https://github.com/StartAutomating/EZOut --> <Types> <Type> <Name>Escape.Sequence</Name> <Members> <ScriptMethod> <Name>alternativeFont</Name> <Script> <# .SYNOPSIS Alternate Font Escape Sequence .DESCRIPTION Escape Sequence for alternate font selection .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES This functionality is not supported in all terminals. #> param( # The alternative font number. [ValidateRange(1,10)] [int]$FontNumber = "$($this.input)" ) $e = [char]27 "$e[$(10 + $fontNumber)m" </Script> </ScriptMethod> <ScriptMethod> <Name>auxOff</Name> <Script> <# .SYNOPSIS Aux Off Escape Sequence .DESCRIPTION Escape Sequence for auxillary output off .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES This functionality is not supported in most terminals. It was often used for printing over a serial port. #> param() $e = [char]27 "$e[4i" </Script> </ScriptMethod> <ScriptMethod> <Name>auxOn</Name> <Script> <# .SYNOPSIS Aux On Escape Sequence .DESCRIPTION Escape Sequence for auxillary output on .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES This functionality is not supported in most terminals. It was often used for printing over a serial port. #> param() $e = [char]27 "$e[5i" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBlack</Name> <Script> <# .SYNOPSIS Background Black Escape Sequence .DESCRIPTION Escape Sequence to set Background to Black .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[40m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBlue</Name> <Script> <# .SYNOPSIS Background Blue Escape Sequence .DESCRIPTION Escape Sequence to set Background to Blue .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[44m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightBlack</Name> <Script> <# .SYNOPSIS Background Bright Black Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Black .NOTES This color is xterm color number 8 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[100m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightBlue</Name> <Script> <# .SYNOPSIS Background Bright Blue Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Blue .NOTES This color is xterm color number 12 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[104m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightCyan</Name> <Script> <# .SYNOPSIS Background Bright Cyan Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Cyan .NOTES This color is xterm color number 14 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[106m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightGreen</Name> <Script> <# .SYNOPSIS Background Bright Green Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Green .NOTES This color is xterm color number 10 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[102m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightPurple</Name> <Script> <# .SYNOPSIS Background Bright Purple Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Purple .NOTES This color is xterm color number 13 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[105m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightRed</Name> <Script> <# .SYNOPSIS Background Bright Red Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Red .NOTES This color is xterm color number 9 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[101m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightWhite</Name> <Script> <# .SYNOPSIS Background Bright White Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright White .NOTES This color is xterm color number 15 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[107m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundBrightYellow</Name> <Script> <# .SYNOPSIS Background Bright Yellow Escape Sequence .DESCRIPTION Escape Sequence to set Background to Bright Yellow .NOTES This color is xterm color number 11 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[103m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundColor</Name> <Script> <# .SYNOPSIS Background Color Escape Sequence .DESCRIPTION Escape Sequence to set Background Color .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [PSObject] $Color = $( if ($null -ne $this.Input -as [byte]) { $this.Input -as [byte] } elseif ($this.Input -and $this.Input -match '^#[a-f0-9]{6}$') { $this.Input } else { 15 } ) ) $e = [char]27 if ($null -ne ($color -as [byte])) { "$e[48;5;${color}m" } elseif ( $color -match '^#[a-f0-9]{6}$' -or $color -match '^random$' ) { if ($matches[0] -eq 'random') { $color = ("#{0:x6}" -f (Get-Random -Maximum 0xffffff)) } $r, $g, $b = $Color.Substring(1,2), $Color.Substring(3,2), $Color.Substring(5,2) "$e[48;2;$( @( "0x$r" -as [byte] "0x$g" -as [byte] "0x$b" -as [byte] ) -join ';' )m" } </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundCyan</Name> <Script> <# .SYNOPSIS Background Cyan Escape Sequence .DESCRIPTION Escape Sequence to set Background to Cyan .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[46m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundDefault</Name> <Script> <# .SYNOPSIS Background default Escape Sequence .DESCRIPTION Escape Sequence to set background to the default. .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[49m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundGreen</Name> <Script> <# .SYNOPSIS Background Green Escape Sequence .DESCRIPTION Escape Sequence to set Background to Green .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[42m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundPurple</Name> <Script> <# .SYNOPSIS Background Purple Escape Sequence .DESCRIPTION Escape Sequence to set Background to Purple .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[45m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundRed</Name> <Script> <# .SYNOPSIS Background Red Escape Sequence .DESCRIPTION Escape Sequence to set Background to Red .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[41m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundWhite</Name> <Script> <# .SYNOPSIS Background White Escape Sequence .DESCRIPTION Escape Sequence to set Background to White .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[47m" </Script> </ScriptMethod> <ScriptMethod> <Name>backgroundYellow</Name> <Script> <# .SYNOPSIS Background Yellow Escape Sequence .DESCRIPTION Escape Sequence to set Background to Yellow .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[43m" </Script> </ScriptMethod> <ScriptMethod> <Name>blink</Name> <Script> <# .SYNOPSIS Blink Escape Sequence .DESCRIPTION Escape Sequence for blink .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Will not work in many terminals. May be distracting when it does. #> param( [switch] $Rapid ) $e = [char]27 if ($rapid) { "$e[6m" } else { "$e[5m" } </Script> </ScriptMethod> <ScriptMethod> <Name>blinkOff</Name> <Script> <# .SYNOPSIS Blink Escape Sequence .DESCRIPTION Escape Sequence for blink .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [switch] $Rapid ) $e = [char]27 "$e[25m" </Script> </ScriptMethod> <ScriptMethod> <Name>bold</Name> <Script> <# .SYNOPSIS Bold Escape Sequence .DESCRIPTION Escape Sequence for Bold (high intensity) text .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[1m" </Script> </ScriptMethod> <ScriptMethod> <Name>clearLine</Name> <Script> <# .SYNOPSIS Clear Line Escape Sequence .DESCRIPTION Escape Sequence for clear line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[2K" </Script> </ScriptMethod> <ScriptMethod> <Name>clearScreen</Name> <Script> <# .SYNOPSIS Clear Screen Escape Sequence .DESCRIPTION Escape Sequence for clear screen .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[2J" </Script> </ScriptMethod> <ScriptMethod> <Name>clearScreenDeleteScrollback</Name> <Script> <# .SYNOPSIS Clear Screen and Delete Scrollback Escape Sequence .DESCRIPTION Escape Sequence for clear screen and delete scrollback .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[3J" </Script> </ScriptMethod> <ScriptMethod> <Name>clearToLineEnd</Name> <Script> <# .SYNOPSIS Clear to End of Line Escape Sequence .DESCRIPTION Escape Sequence for clear to end of line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[1K" </Script> </ScriptMethod> <ScriptMethod> <Name>clearToLineStart</Name> <Script> <# .SYNOPSIS Clear to Start of Line Escape Sequence .DESCRIPTION Escape Sequence for clear to start of line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[0K" </Script> </ScriptMethod> <ScriptMethod> <Name>clearToScreenEnd</Name> <Script> <# .SYNOPSIS Clear to End of Screen Escape Sequence .DESCRIPTION Escape Sequence for clear to end of stream .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[1J" </Script> </ScriptMethod> <ScriptMethod> <Name>clearToScreenStart</Name> <Script> <# .SYNOPSIS Clear to Start of Screen Escape Sequence .DESCRIPTION Escape Sequence for clear to start of the stream .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES #> param() $e = [char]27 "$e[0J" </Script> </ScriptMethod> <ScriptMethod> <Name>conceal</Name> <Script> <# .SYNOPSIS Conceal Escape Sequence .DESCRIPTION Escape Sequence for concealed content .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( ) $e = [char]27 "$e[8m" </Script> </ScriptMethod> <ScriptMethod> <Name>crossout</Name> <Script> <# .SYNOPSIS Crossout Escape Sequence .DESCRIPTION Escape Sequence for crossed out text .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[9m" </Script> </ScriptMethod> <ScriptMethod> <Name>crossoutOff</Name> <Script> <# .SYNOPSIS Crossout Off Escape Sequence .DESCRIPTION Escape Sequence for stopping cross out text .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[29m" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorAbsoluteLine</Name> <Script> <# .SYNOPSIS Cursor Absolute Line Escape Sequence .DESCRIPTION Escape Sequence to move the cursor to the absolute line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The line to move to. [int]$LineCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 "$e[$($LineCount)d" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorBackward</Name> <Script> <# .SYNOPSIS Cursor Backward Escape Sequence .DESCRIPTION Escape Sequence to move the cursor backward .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The number of cells to move [int]$CellCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($CellCount -lt 0) { "$e[${CellCount}C" } else { "$e[${CellCount}D" } </Script> </ScriptMethod> <ScriptMethod> <Name>cursorBlinkOff</Name> <Script> <# .SYNOPSIS Cursor Blink Off Escape Sequence .DESCRIPTION Escape Sequence for Cursor Blink Off .NOTES This setting is often ignored. Many terminals do not enable a blinking cursor. Many others use to various cursor shapes to enable blinking. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[?12h" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorBlinkOn</Name> <Script> <# .SYNOPSIS Cursor Blink On Escape Sequence .DESCRIPTION Escape Sequence for Cursor Blink On .NOTES This setting is often ignored. Many terminals do not enable a blinking cursor. Many others use to various cursor shapes to enable blinking. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[?12h" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorDown</Name> <Script> <# .SYNOPSIS Cursor Down Escape Sequence .DESCRIPTION Escape Sequence to move the cursor down .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The number of cells to move. [int]$CellCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($CellCount -lt 0) { "$e[${CellCount}A" } else { "$e[${CellCount}B" } </Script> </ScriptMethod> <ScriptMethod> <Name>cursorForward</Name> <Script> <# .SYNOPSIS Cursor Forward Escape Sequence .DESCRIPTION Escape Sequence to move the cursor forward .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The number of cells to move. [int]$CellCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($CellCount -ge 0) { "$e[${CellCount}C" } else { "$e[${CellCount}D" } </Script> </ScriptMethod> <ScriptMethod> <Name>cursorHide</Name> <Script> <# .SYNOPSIS Hide Cursor Escape Sequence .DESCRIPTION Escape Sequence to hide the cursor .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[25l" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorNextLine</Name> <Script> <# .SYNOPSIS Cursor Next Line Escape Sequence .DESCRIPTION Escape Sequence to move the cursor to the next line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The number of cells to move. [int]$LineCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($LineCount -gt 0) { "$e[${LineCount}E" } else { "$e[${LineCount}F" } </Script> </ScriptMethod> <ScriptMethod> <Name>cursorPosition</Name> <Script> <# .SYNOPSIS Set Cursor Position .DESCRIPTION Escape Sequence for Set Cursor Position .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The row. [int]$Row = 1, # The column. [int]$Column = 1 ) $e = [char]27 "$e[${Row};${column}H" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorPreviousLine</Name> <Script> <# .SYNOPSIS Cursor Next Line Escape Sequence .DESCRIPTION Escape Sequence to move the cursor to the next line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The number of cells to move. [int]$LineCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($LineCount -lt 0) { "$e[${LineCount}E" } else { "$e[${LineCount}F" } </Script> </ScriptMethod> <ScriptMethod> <Name>cursorRelativeLine</Name> <Script> <# .SYNOPSIS Cursor Relative Line Escape Sequence .DESCRIPTION Escape Sequence to move the cursor to the relative line .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Not supported in all terminals #> param( # The number of lines to move. [int]$LineCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 "$e[$($LineCount)e" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorRestore</Name> <Script> <# .SYNOPSIS Restore Cursor Escape Sequence .DESCRIPTION Escape Sequence to restore the cursor position .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[u" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorSave</Name> <Script> <# .SYNOPSIS Save Cursor Escape Sequence .DESCRIPTION Escape Sequence to save the cursor position .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[s" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeBar</Name> <Script> <# .SYNOPSIS Cursor Shape Bar Escape Sequence .DESCRIPTION Escape Sequence for Bar Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[6 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeBlinkingBar</Name> <Script> <# .SYNOPSIS Cursor Shape Blinking Bar Escape Sequence .DESCRIPTION Escape Sequence for Blinking Bar Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[5 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeBlinkingBlock</Name> <Script> <# .SYNOPSIS Cursor Shape Blinking Block Escape Sequence .DESCRIPTION Escape Sequence for Blinking Block Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[1 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeBlinkingUnderline</Name> <Script> <# .SYNOPSIS Cursor Shape Blinking Underline Escape Sequence .DESCRIPTION Escape Sequence for Blinking Underline Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[3 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeBlock</Name> <Script> <# .SYNOPSIS Cursor Shape Block Escape Sequence .DESCRIPTION Escape Sequence for Block Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[2 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeDefault</Name> <Script> <# .SYNOPSIS Cursor Shape Default Escape Sequence .DESCRIPTION Escape Sequence for Default Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[0 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShapeUnderline</Name> <Script> <# .SYNOPSIS Cursor Shape Underline Escape Sequence .DESCRIPTION Escape Sequence for Underline Cursor Shape .NOTES This setting is sometimes ignored. Many terminals do not enable a blinking cursor. .LINK https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences #> param() $e = [char]27 "$e[4 q" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorShow</Name> <Script> <# .SYNOPSIS Show Cursor Escape Sequence .DESCRIPTION Escape Sequence to show the cursor .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[25h" </Script> </ScriptMethod> <ScriptMethod> <Name>cursorUp</Name> <Script> <# .SYNOPSIS Cursor Up Escape Sequence .DESCRIPTION Escape Sequence to move the cursor up .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( # The number of cells to move. [int]$CellCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($CellCount -gt 0) { "$e[${CellCount}A" } else { "$e[${CellCount}B" } </Script> </ScriptMethod> <ScriptMethod> <Name>disableAlternateScreenBuffer</Name> <Script> <# .SYNOPSIS Disable Alternate Screen BufferEscape Sequence .DESCRIPTION Escape Sequence for Disable Alternate Screen Buffer .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Disable Alternate Screen Buffer is supported in xterm. #> param() $e = [char]27 "$e[1049l" </Script> </ScriptMethod> <ScriptMethod> <Name>disableReportingFocus</Name> <Script> <# .SYNOPSIS Disable Reporting Focus Escape Sequence .DESCRIPTION Escape Sequence for Disable Reporting Focus .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Disable reporting focus. Stops reporting whenever terminal emulator enters or exits focus as ESC [I and ESC [O, respectively. #> param() $e = [char]27 "$e[1004l" </Script> </ScriptMethod> <ScriptMethod> <Name>doubleHeightLetterBottom</Name> <Script> <# .SYNOPSIS Double height letter bottom .DESCRIPTION Escape sequence for double height letter bottom. This will draw the bottom half of characters at double height. .NOTES This is not supported in all terminals. .EXAMPLE @( "$(escape doubleHeightLetterTop)Hello World" "$(escape doubleHeightLetterBottom)Hello World" ) -join [Environment]::Newline #> param() "$([char]27)#4" </Script> </ScriptMethod> <ScriptMethod> <Name>doubleHeightLetterTop</Name> <Script> <# .SYNOPSIS Double height letter top .DESCRIPTION Escape sequence for double height letter top. This will draw the top half of characters at double height. .NOTES This is not supported in all terminals. .EXAMPLE @( "$(escape doubleHeightLetterTop)Hello World" "$(escape doubleHeightLetterBottom)Hello World" ) -join [Environment]::Newline #> param() "$([char]27)#3" </Script> </ScriptMethod> <ScriptMethod> <Name>doubleUnderline</Name> <Script> <# .SYNOPSIS Double Underline Escape Sequence .DESCRIPTION Escape Sequence for double underline .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[21m" </Script> </ScriptMethod> <ScriptMethod> <Name>enableAlternateScreenBuffer</Name> <Script> <# .SYNOPSIS Enable Alternate Screen BufferEscape Sequence .DESCRIPTION Escape Sequence for Enable Alternate Screen Buffer .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Enable Alternate Screen Buffer is supported in xterm. #> param() $e = [char]27 "$e[1049h" </Script> </ScriptMethod> <ScriptMethod> <Name>enableReportingFocus</Name> <Script> <# .SYNOPSIS Enable Reporting Focus Escape Sequence .DESCRIPTION Escape Sequence for Enable Reporting Focus .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Enable reporting focus. Reports whenever terminal emulator enters or exits focus as ESC [I and ESC [O, respectively. #> param() $e = [char]27 "$e[1004h" </Script> </ScriptMethod> <ScriptMethod> <Name>encircled</Name> <Script> <# .SYNOPSIS Encircled Escape Sequence .DESCRIPTION Escape Sequence for encircled .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Not supported by most terminals. Used for Emoji variation selection in mintty. #> param() $e = [char]27 "$e[52m" </Script> </ScriptMethod> <ScriptMethod> <Name>enterLineDrawMode</Name> <Script> <# .SYNOPSIS Enter Line Draw Mode Escape Sequence .DESCRIPTION Escape Sequence to Enter Line Draw Mode .NOTES If Line Drawing mode is supported by a terminal, it will switch some regular characters into line and box drawing characters. This will be quite hard for people to read, and should be used sparingly. #> $e = [char]27 "$e(0" </Script> </ScriptMethod> <ScriptMethod> <Name>exitLineDrawMode</Name> <Script> <# .SYNOPSIS Exit Line Draw Mode Escape Sequence .DESCRIPTION Escape Sequence to Exit Line Draw Mode .NOTES If Line Drawing mode is supported by a terminal, it will switch some regular characters into line and box drawing characters. This will be quite hard for people to read, and should be used sparingly. #> $e = [char]27 "$e(B" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBlack</Name> <Script> <# .SYNOPSIS Foreground Black Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Black .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[30m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBlue</Name> <Script> <# .SYNOPSIS Foreground Blue Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Blue .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[34m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightBlack</Name> <Script> <# .SYNOPSIS Foreground Bright Black Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Black .NOTES This color is xterm color number 8 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[90m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightBlue</Name> <Script> <# .SYNOPSIS Foreground Bright Blue Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Blue .NOTES This color is xterm color number 12 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[94m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightCyan</Name> <Script> <# .SYNOPSIS Foreground Bright Cyan Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Cyan .NOTES This color is xterm color number 14 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[96m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightGreen</Name> <Script> <# .SYNOPSIS Foreground Bright Green Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Green .NOTES This color is xterm color number 10 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[92m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightPurple</Name> <Script> <# .SYNOPSIS Foreground Bright Purple Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Purple .NOTES This color is xterm color number 13 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[95m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightRed</Name> <Script> <# .SYNOPSIS Foreground Bright Red Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Red .NOTES This color is xterm color number 9 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[91m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightWhite</Name> <Script> <# .SYNOPSIS Foreground Bright White Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright White .NOTES This color is xterm color number 15 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[97m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundBrightYellow</Name> <Script> <# .SYNOPSIS Foreground Bright Yellow Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Bright Yellow .NOTES This color is xterm color number 11 .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[93m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundColor</Name> <Script> <# .SYNOPSIS Foreground Color Escape Sequence .DESCRIPTION Escape Sequence to set Foreground Color .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [PSObject] $Color = $( if ($null -ne $this.Input -as [byte]) { $this.Input -as [byte] } elseif ($this.Input -and $this.Input -match '^#[a-f0-9]{6}$') { $this.Input } else { 15 } ) ) $e = [char]27 if ($null -ne ($color -as [byte])) { "$e[38;5;${color}m" } elseif ( $color -match '^#[a-f0-9]{6}$' -or $color -match '^random$' ) { if ($matches[0] -eq 'random') { $color = ("#{0:x6}" -f (Get-Random -Maximum 0xffffff)) } $r, $g, $b = $Color.Substring(1,2), $Color.Substring(3,2), $Color.Substring(5,2) "$e[38;2;$( @( "0x$r" -as [byte] "0x$g" -as [byte] "0x$b" -as [byte] ) -join ';' )m" } </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundCyan</Name> <Script> <# .SYNOPSIS Foreground Cyan Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Cyan .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[36m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundDefault</Name> <Script> <# .SYNOPSIS Foreground default Escape Sequence .DESCRIPTION Escape Sequence to set foreground to the default. .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[39m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundGreen</Name> <Script> <# .SYNOPSIS Foreground Green Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Green .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[32m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundPurple</Name> <Script> <# .SYNOPSIS Foreground Purple Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Purple .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[35m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundRed</Name> <Script> <# .SYNOPSIS Foreground Red Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Red .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[31m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundWhite</Name> <Script> <# .SYNOPSIS Foreground White Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to White .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[37m" </Script> </ScriptMethod> <ScriptMethod> <Name>foregroundYellow</Name> <Script> <# .SYNOPSIS Foreground Yellow Escape Sequence .DESCRIPTION Escape Sequence to set Foreground to Yellow .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> $e = [char]27 "$e[33m" </Script> </ScriptMethod> <ScriptMethod> <Name>framed</Name> <Script> <# .SYNOPSIS Framed Escape Sequence .DESCRIPTION Escape Sequence for framed .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Not supported by most terminals. Used for Emoji variation selection in mintty #> param() $e = [char]27 "$e[51m" </Script> </ScriptMethod> <ScriptMethod> <Name>html</Name> <Script> <# .SYNOPSIS .DESCRIPTION .EXAMPLE ./html.escape.ps1 "<escape this tag>" #> param( [string] $Content = "$($this.Input)" ) [Web.HttpUtility]::HtmlEncode($Content) </Script> </ScriptMethod> <ScriptMethod> <Name>htmlAttribute</Name> <Script> <# .SYNOPSIS Escapes html attributes .DESCRIPTION Escapes content for encoding into an html attribute. .EXAMPLE ./html.escape.ps1 "<escape this tag>" #> param( [string] $Content = "$($this.Content)" ) [Web.HttpUtility]::HtmlAttributeEncode($Content) </Script> </ScriptMethod> <ScriptMethod> <Name>hyperlink</Name> <Script> <# .SYNOPSIS Hyperlink Escape Sequence .DESCRIPTION Escape Sequence for a Hyperlink #> param( # The link uri [alias('Url')] [uri] $Uri, # The link text [string] $Text ) if (-not $uri) { return } if (-not $text) { $text = $uri } $e = [char]27 "$e]8;;${uri}$e\${text}$e]8;;$e\" </Script> </ScriptMethod> <ScriptMethod> <Name>ideogramDoubleOverline</Name> <Script> <# .SYNOPSIS Ideogram Double Overline Escape Sequence .DESCRIPTION Escape Sequence for Ideogram Double Overline Ideogram escape sequences are supported in some loclized terminals. #> param() $e = [char]27 "$e[63m" </Script> </ScriptMethod> <ScriptMethod> <Name>ideogramDoubleUnderline</Name> <Script> <# .SYNOPSIS Ideogram Double Underline Escape Sequence .DESCRIPTION Escape Sequence for Ideogram Double Underline Ideogram escape sequences are supported in some loclized terminals. #> param() $e = [char]27 "$e[61m" </Script> </ScriptMethod> <ScriptMethod> <Name>ideogramOverline</Name> <Script> <# .SYNOPSIS Ideogram Overline Escape Sequence .DESCRIPTION Escape Sequence for Ideogram Overline Ideogram escape sequences are supported in some loclized terminals. #> param() $e = [char]27 "$e[62m" </Script> </ScriptMethod> <ScriptMethod> <Name>ideogramReset</Name> <Script> <# .SYNOPSIS Ideogram Reset Escape Sequence .DESCRIPTION Escape Sequence for Ideogram Reset Ideogram escape sequences are supported in some loclized terminals. #> param() $e = [char]27 "$e[65m" </Script> </ScriptMethod> <ScriptMethod> <Name>ideogramStress</Name> <Script> <# .SYNOPSIS Ideogram Stress Escape Sequence .DESCRIPTION Escape Sequence for Ideogram Stress Ideogram escape sequences are supported in some loclized terminals. #> param() $e = [char]27 "$e[64m" </Script> </ScriptMethod> <ScriptMethod> <Name>ideogramUnderline</Name> <Script> <# .SYNOPSIS Ideogram Underline Escape Sequence .DESCRIPTION Escape Sequence for Ideogram Underline Ideogram escape sequences are supported in some loclized terminals. #> param() $e = [char]27 "$e[60m" </Script> </ScriptMethod> <ScriptMethod> <Name>italic</Name> <Script> <# .SYNOPSIS Italic Escape Sequence .DESCRIPTION Escape Sequence for italics .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[3m" </Script> </ScriptMethod> <ScriptMethod> <Name>italicOff</Name> <Script> <# .SYNOPSIS Italic Off Escape Sequence .DESCRIPTION Escape Sequence for italics off .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[23m" </Script> </ScriptMethod> <ScriptMethod> <Name>lastLine</Name> <Script> <# .SYNOPSIS Last Line Escape Sequence .DESCRIPTION Escape Sequence for last line. Moves to the start of the previous line. .LINK https://en.wikipedia.org/wiki/C0_and_C1_control_codes .NOTES #> param() $e = [char]27 "${e}M" </Script> </ScriptMethod> <ScriptMethod> <Name>lineWidthDouble</Name> <Script> <# .SYNOPSIS Line width double .DESCRIPTION Escape sequence for double line width. This will draw the line using double character width. .NOTES This is not supported in all terminals. .EXAMPLE "$(escape lineWidthNormal)Hello World" "$(escape lineWidthDouble)Hello World" .LINK https://en.wikipedia.org/wiki/ANSI_escape_code#nF_Escape_sequences #> param() "$([char]27)#6" </Script> </ScriptMethod> <ScriptMethod> <Name>lineWidthNormal</Name> <Script> <# .SYNOPSIS Line width normal .DESCRIPTION Escape sequence for normal line width. This will draw the line using the normal character width. .NOTES This is not supported in all terminals. .EXAMPLE "$(escape lineWidthNormal)Hello World" "$(escape lineWidthDouble)Hello World" .LINK https://en.wikipedia.org/wiki/ANSI_escape_code#nF_Escape_sequences #> param() "$([char]27)#5" </Script> </ScriptMethod> <ScriptMethod> <Name>musicNote</Name> <Script> <# .SYNOPSIS Music Note Escape Sequence .DESCRIPTION Escape sequence for musical notes. Plays one or more notes in a limited range, for a specified duration (rounded to the nearest 32nd of a second) .NOTES These notes will only work in a limited number of terminals. These notes have a limited two-octave range. #> [Alias('Notes')] param( # One or more notes. [Alias('Notes')] [ValidateSet( 'REST', 'C5', 'C#5', 'D5', 'D#5', 'E5', 'F5', 'F#5', 'G5', 'G#5', 'A5', 'A#5', 'B5', 'C6', 'C#6', 'D6', 'D#6', 'E6', 'F6', 'F#6', 'G6', 'G#6', 'A6', 'A#6', 'B6', 'C7' )] [string[]] $Note = 'C5', # The duration to play the note. [Alias('NoteTiming')] [timespan] $Duration = $([Timespan]::FromMilliseconds(1000 * 8/32 )), # The volume of the note (default 3) [Alias('NoteVolume')] [ValidateRange(0,7)] [int] $Volume = 3 ) $duration32nds = [Math]::Round($Duration.TotalMilliseconds / (1/32 * 1000)) $noteValues = $MyInvocation.MyCommand.Parameters.Note.Attributes.ValidValues $notes = @( foreach ($n in $note) { $noteValues.IndexOf($n.ToUpper()) } ) -join ';' $e =[char]27 "$e[$volume;$duration32nds;$notes,~" </Script> </ScriptMethod> <ScriptMethod> <Name>nextLine</Name> <Script> <# .SYNOPSIS Next Line Escape Sequence .DESCRIPTION Escape Sequence for next line. Moves to the start of the next line. Equivalent to a newline and a carriage return. .LINK https://en.wikipedia.org/wiki/C0_and_C1_control_codes #> param() $e = [char]27 "${e}E" </Script> </ScriptMethod> <ScriptMethod> <Name>normalIntensity</Name> <Script> <# .SYNOPSIS Normal Intensity Escape Sequence .DESCRIPTION Escape Sequence to use normal font intensity .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [switch] $Rapid ) $e = [char]27 "$e[22m" </Script> </ScriptMethod> <ScriptMethod> <Name>normalscript</Name> <Script> <# .SYNOPSIS Normal Script Escape Sequence .DESCRIPTION Escape Sequence for neither superscript not subscript .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Implemented in mintty #> param() $e = [char]27 "$e[75m" </Script> </ScriptMethod> <ScriptMethod> <Name>notFramed</Name> <Script> <# .SYNOPSIS Not Framed Escape Sequence .DESCRIPTION Escape Sequence for neither framed nor encircled .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Not supported by most terminals. Used for Emoji variation selection in mintty. #> param() $e = [char]27 "$e[54m" </Script> </ScriptMethod> <ScriptMethod> <Name>overline</Name> <Script> <# .SYNOPSIS Overline Escape Sequence .DESCRIPTION Escape Sequence for overline .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[53m" </Script> </ScriptMethod> <ScriptMethod> <Name>overlineOff</Name> <Script> <# .SYNOPSIS Overline Off Escape Sequence .DESCRIPTION Escape Sequence for overline off .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[55m" </Script> </ScriptMethod> <ScriptMethod> <Name>proportionalSpacing</Name> <Script> <# .SYNOPSIS Proportial Spacing Escape Sequence .DESCRIPTION Escape Sequence to stop Proportial Spacing .NOTES Unused in modern terminals .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[26m" </Script> </ScriptMethod> <ScriptMethod> <Name>proportionalSpacingOff</Name> <Script> <# .SYNOPSIS Proportial Spacing Off Escape Sequence .DESCRIPTION Escape Sequence to stop Proportial Spacing .NOTES Unused in modern terminals .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[26m" </Script> </ScriptMethod> <ScriptMethod> <Name>reset</Name> <Script> <# .SYNOPSIS Reset Escape Sequence .DESCRIPTION Escape Sequence for reset .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( ) $e = [char]27 "$e[0m" </Script> </ScriptMethod> <ScriptMethod> <Name>reveal</Name> <Script> <# .SYNOPSIS Reveal Escape Sequence .DESCRIPTION Escape Sequence for to disable concealed content .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( ) $e = [char]27 "$e[28m" </Script> </ScriptMethod> <ScriptMethod> <Name>reverse</Name> <Script> <# .SYNOPSIS Invert Escape Sequence .DESCRIPTION Escape Sequence for invert .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( ) $e = [char]27 "$e[7m" </Script> </ScriptMethod> <ScriptMethod> <Name>reverseOff</Name> <Script> <# .SYNOPSIS Reverse Off Escape Sequence .DESCRIPTION Escape Sequence for stopping color reversal (inversion) in text .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( ) $e = [char]27 "$e[27m" </Script> </ScriptMethod> <ScriptMethod> <Name>screenAlignmentPattern</Name> <Script> <# .SYNOPSIS Screen Alignment Pattern Escape sequence .DESCRIPTION Escape Sequence for the Screen Alignment Pattern. This is normally a screen full of "E" characters. .NOTES Implemented more places than you would expect. Normally prints a screen full of "E" characters, but some hosts (like VSCode) may temporarily show alignment gridlines in other areas of the UI. .LINK https://web.mit.edu/dosathena/doc/www/ek-vt520-rm.pdf #> param() $e = [char]27 "$e#8" </Script> </ScriptMethod> <ScriptMethod> <Name>scrollDown</Name> <Script> <# .SYNOPSIS Scroll Down Escape Sequence .DESCRIPTION Escape Sequence for Scroll Down .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [int]$PageCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($pageCount -ge 0) { "$e[${PageCount}T" } else { "$e[${PageCount}S" } </Script> </ScriptMethod> <ScriptMethod> <Name>scrollUp</Name> <Script> <# .SYNOPSIS Scroll Up Escape Sequence .DESCRIPTION Escape Sequence for Scroll Up .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [int]$PageCount = $( if ("$($this.input)" -as [int]) { "$($this.input)" } else { 1 } ) ) $e = [char]27 if ($PageCount -ge 0) { "$e[${PageCount}S" } else { "$e[${PageCount}T" } </Script> </ScriptMethod> <ScriptMethod> <Name>setColor</Name> <Script> <# .SYNOPSIS Set Color Escape Sequence .DESCRIPTION Escape Sequence to Set Colors. This accepts a number and a color to change. .NOTES Not all numbers are supported in all terminals. * 0-7 are the normal intensity colors * 8-15 are the high intensity colors * 16-231 default to a 6x6x6 color cube * 232-255 are a greyscale ramp, without black or white * Additional numbers may be used for any purpose perscribed by the terminal #> param( # The number of the color to set [int] $Number = $( $num, $null = @($this.Input) if ($num) { $num } ), # The color to set. [ValidatePattern('^(?>random|\#[0-9a-f]{6})$')] [string] $Color = $( $null, $color, $null = @($this.Input) $color ) ) if (-not $color) { return } if ($color -eq 'random') { $color = '#{0:x6}' -f (Get-Random -Max 0xffffff) } $r, $g, $b = $Color.Substring(1,2), $Color.Substring(3,2), $Color.Substring(5,2) $e = [char]27 "$e]4;$Number;rgb:$r/$g/$b$e\" </Script> </ScriptMethod> <ScriptMethod> <Name>setTabBackgroundColor</Name> <Script> <# .SYNOPSIS Set tab background color escape sequence .DESCRIPTION Escape sequence to set the tab background color #> param( [ValidatePattern('^(?>random|\#[0-9a-f]{6})$')] [string] $TabColor = "$($this.Input)" ) if ($tabColor -eq 'random') { $TabColor = "#{0:x6}" -f (Get-Random -Max 0xffffff) } if (-not $tabColor) { return } $r, $g, $b = $TabColor.Substring(1,2), $TabColor.Substring(3,2), $TabColor.Substring(5,2) $e = [char]27 "$e]4;264;rgb:$r/$g/$b$e\" </Script> </ScriptMethod> <ScriptMethod> <Name>setTabForegroundColor</Name> <Script> <# .SYNOPSIS Tab Foreground Color Escape Sequence .DESCRIPTION Escape Sequence for setting Tab Foreground Color .NOTES This works in a few terminals. #> param( [ValidatePattern('^(?>random|\#[0-9a-f]{6})$')] [string] $TabColor = "$($this.Input)" ) if ($tabColor -eq 'random') { $TabColor = "#{0:x6}" -f (Get-Random -Max 0xffffff) } $r, $g, $b = $TabColor.Substring(1,2), $TabColor.Substring(3,2), $TabColor.Substring(5,2) $e = [char]27 "$e]4;263;rgb:$r/$g/$b$e\" </Script> </ScriptMethod> <ScriptMethod> <Name>subscript</Name> <Script> <# .SYNOPSIS Subscript Escape Sequence .DESCRIPTION Escape Sequence for subscript .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Implemented in mintty #> param() $e = [char]27 "$e[74m" </Script> </ScriptMethod> <ScriptMethod> <Name>superscript</Name> <Script> <# .SYNOPSIS Superscript Escape Sequence .DESCRIPTION Escape Sequence for superscript .LINK https://en.wikipedia.org/wiki/ANSI_escape_code .NOTES Implemented in mintty #> param() $e = [char]27 "$e[73m" </Script> </ScriptMethod> <ScriptMethod> <Name>underline</Name> <Script> <# .SYNOPSIS Underline Escape Sequence .DESCRIPTION Escape Sequence for underline .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[4m" </Script> </ScriptMethod> <ScriptMethod> <Name>underlineColor</Name> <Script> <# .SYNOPSIS Underline Color Escape Sequence .DESCRIPTION Escape Sequence to set Underline Color .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [PSObject] $Color = $( if ($null -ne $this.Input -as [byte]) { $this.Input -as [byte] } elseif ($this.Input -and $this.Input -match '^#[a-f0-9]{6}$') { $this.Input } else { 15 } ) ) $e = [char]27 if ($null -ne $color -as [byte]) { "$e[58;5;${color}m" } elseif ( $color -match '^#[a-f0-9]{6}$' -or $color -match '^random$' ) { if ($matches[0] -eq 'random') { $color = ("#{0:x6}" -f (Get-Random -Maximum 0xffffff)) } $r, $g, $b = $Color.Substring(1,2), $Color.Substring(3,2), $Color.Substring(5,2) "$e[58;2;$( @( "0x$r" -as [byte] "0x$g" -as [byte] "0x$b" -as [byte] ) -join ';' )m" } </Script> </ScriptMethod> <ScriptMethod> <Name>underlineDefault</Name> <Script> <# .SYNOPSIS Underline Default Escape Sequence .DESCRIPTION Escape Sequence for underline default coloring .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param() $e = [char]27 "$e[59m" </Script> </ScriptMethod> <ScriptMethod> <Name>underlineOff</Name> <Script> <# .SYNOPSIS Underline off Escape Sequence .DESCRIPTION Escape Sequence to stop underlining .LINK https://en.wikipedia.org/wiki/ANSI_escape_code #> param( [switch] $Rapid ) $e = [char]27 "$e[24m" </Script> </ScriptMethod> <ScriptMethod> <Name>xml</Name> <Script> <# .SYNOPSIS Escapes xml .DESCRIPTION Escapes content into valid xml content. .EXAMPLE ./xml.ps1 "<not a tag>" #> param( [string] $Content = "$($this.Input)" ) [Web.HttpUtility]::HtmlEncode($Content) </Script> </ScriptMethod> </Members> </Type> </Types> |