package core:encoding/ansi

⌘K
Ctrl+K
or
/

    Overview

    package ansi implements constant references to many widely-supported ANSI escape codes, primarily used in terminal emulators for enhanced graphics, such as colors, text styling, and animated displays.

    For example, you can print out a line of cyan text like this:

    fmt.println(ansi.CSI + ansi.FG_CYAN + ansi.SGR + "Hellope!" + ansi.CSI + ansi.RESET + ansi.SGR)
    
    

    Multiple SGR (Select Graphic Rendition) codes can be joined by semicolons:

    fmt.println(ansi.CSI + ansi.BOLD + ";" + ansi.FG_BLUE + ansi.SGR + "Hellope!" + ansi.CSI + ansi.RESET + ansi.SGR)
    
    

    If your terminal supports 24-bit true color mode, you can also do this:

    fmt.println(ansi.CSI + ansi.FG_COLOR_24_BIT + ";0;255;255" + ansi.SGR + "Hellope!" + ansi.CSI + ansi.RESET + ansi.SGR)
    
    

    For more information, see: https://en.wikipedia.org/wiki/ANSI_escape_code https://www.vt100.net/docs/vt102-ug/chapter5.html https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

    Types

    This section is empty.

    Constants

    AUX_OFF ¶

    AUX_OFF :: "4i"
     

    AUX Port Off

    AUX_ON ¶

    AUX_ON :: "5i"
     

    AUX Port On

    BEL ¶

    BEL :: "\a"
     

    Bell

    BG_BLACK ¶

    BG_BLACK :: "40"

    BG_BLUE ¶

    BG_BLUE :: "44"

    BG_BRIGHT_BLACK ¶

    BG_BRIGHT_BLACK :: "100"
     

    Also known as grey.

    BG_BRIGHT_BLUE ¶

    BG_BRIGHT_BLUE :: "104"

    BG_BRIGHT_CYAN ¶

    BG_BRIGHT_CYAN :: "106"

    BG_BRIGHT_GREEN ¶

    BG_BRIGHT_GREEN :: "102"

    BG_BRIGHT_MAGENTA ¶

    BG_BRIGHT_MAGENTA :: "105"

    BG_BRIGHT_RED ¶

    BG_BRIGHT_RED :: "101"

    BG_BRIGHT_WHITE ¶

    BG_BRIGHT_WHITE :: "107"

    BG_BRIGHT_YELLOW ¶

    BG_BRIGHT_YELLOW :: "103"

    BG_COLOR ¶

    BG_COLOR :: "48"

    BG_COLOR_24_BIT ¶

    BG_COLOR_24_BIT :: "48;2"
     

    Followed by ";r;g;b" where r,g,b are in 0..=255

    BG_COLOR_8_BIT ¶

    BG_COLOR_8_BIT :: "48;5"
     

    Followed by ";n" where n is in 0..=255

    BG_CYAN ¶

    BG_CYAN :: "46"

    BG_DEFAULT ¶

    BG_DEFAULT :: "49"

    BG_GREEN ¶

    BG_GREEN :: "42"

    BG_MAGENTA ¶

    BG_MAGENTA :: "45"

    BG_RED ¶

    BG_RED :: "41"

    BG_WHITE ¶

    BG_WHITE :: "47"

    BG_YELLOW ¶

    BG_YELLOW :: "43"
    BLINK_RAPID :: "6"
     

    Not widely supported.

    BLINK_SLOW :: "5"

    BOLD ¶

    BOLD :: "1"

    BS ¶

    BS :: "\b"
     

    Backspace

    CHA ¶

    CHA :: "G"
     

    Cursor Horizontal Absolute

    CLIPBOARD ¶

    CLIPBOARD :: "52"
     

    Followed by ";c;<Base64-encoded string>" ST.

    CNL ¶

    CNL :: "E"
     

    Cursor Next Line

    CPL ¶

    CPL :: "F"
     

    Cursor Previous Line

    CSI ¶

    CSI :: ESC + "["
     

    Control Sequence Introducer

    CUB ¶

    CUB :: "D"
     

    Cursor Back

    CUD ¶

    CUD :: "B"
     

    Cursor Down

    CUF ¶

    CUF :: "C"
     

    Cursor Forward

    CUP ¶

    CUP :: "H"
     

    Cursor Position

    CUU ¶

    CUU :: "A"
     

    Cursor Up

    DECAWM_OFF ¶

    DECAWM_OFF :: "?7l"
     

    Auto Wrap Mode (Disabled)

    DECAWM_ON ¶

    DECAWM_ON :: "?7h"
     

    Auto Wrap Mode (Enabled)

    DECRC ¶

    DECRC :: ESC + "8"
     

    DEC Restore Cursor

    DECSC ¶

    DECSC :: ESC + "7"
     

    DEC Save Cursor

    DECTCEM_HIDE ¶

    DECTCEM_HIDE :: "?25l"
     

    Text Cursor Enable Mode (Invisible)

    DECTCEM_SHOW ¶

    DECTCEM_SHOW :: "?25h"
     

    Text Cursor Enable Mode (Visible)

    DSR ¶

    DSR :: "6n"
     

    Device Status Report

    ED ¶

    ED :: "J"
     

    Erase in Display

    EL ¶

    EL :: "K"
     

    Erase in Line

    ENCIRCLED ¶

    ENCIRCLED :: "52"

    ESC ¶

    ESC :: "\e"
     

    Escape

    FAINT ¶

    FAINT :: "2"

    FG_BLACK ¶

    FG_BLACK :: "30"

    FG_BLUE ¶

    FG_BLUE :: "34"

    FG_BRIGHT_BLACK ¶

    FG_BRIGHT_BLACK :: "90"
     

    Also known as grey.

    FG_BRIGHT_BLUE ¶

    FG_BRIGHT_BLUE :: "94"

    FG_BRIGHT_CYAN ¶

    FG_BRIGHT_CYAN :: "96"

    FG_BRIGHT_GREEN ¶

    FG_BRIGHT_GREEN :: "92"

    FG_BRIGHT_MAGENTA ¶

    FG_BRIGHT_MAGENTA :: "95"

    FG_BRIGHT_RED ¶

    FG_BRIGHT_RED :: "91"

    FG_BRIGHT_WHITE ¶

    FG_BRIGHT_WHITE :: "97"

    FG_BRIGHT_YELLOW ¶

    FG_BRIGHT_YELLOW :: "93"

    FG_COLOR ¶

    FG_COLOR :: "38"

    FG_COLOR_24_BIT ¶

    FG_COLOR_24_BIT :: "38;2"
     

    Followed by ";r;g;b" where r,g,b are in 0..=255

    FG_COLOR_8_BIT ¶

    FG_COLOR_8_BIT :: "38;5"
     

    Followed by ";n" where n is in 0..=255

    FG_CYAN ¶

    FG_CYAN :: "36"

    FG_DEFAULT ¶

    FG_DEFAULT :: "39"

    FG_GREEN ¶

    FG_GREEN :: "32"

    FG_MAGENTA ¶

    FG_MAGENTA :: "35"

    FG_RED ¶

    FG_RED :: "31"

    FG_WHITE ¶

    FG_WHITE :: "37"

    FG_YELLOW ¶

    FG_YELLOW :: "33"

    FONT_ALT1 ¶

    FONT_ALT1 :: "11"

    FONT_ALT2 ¶

    FONT_ALT2 :: "12"

    FONT_ALT3 ¶

    FONT_ALT3 :: "13"

    FONT_ALT4 ¶

    FONT_ALT4 :: "14"

    FONT_ALT5 ¶

    FONT_ALT5 :: "15"

    FONT_ALT6 ¶

    FONT_ALT6 :: "16"

    FONT_ALT7 ¶

    FONT_ALT7 :: "17"

    FONT_ALT8 ¶

    FONT_ALT8 :: "18"

    FONT_ALT9 ¶

    FONT_ALT9 :: "19"

    FONT_FRAKTUR ¶

    FONT_FRAKTUR :: "20"
     

    Rarely supported.

    FONT_PRIMARY ¶

    FONT_PRIMARY :: "10"

    FRAMED ¶

    FRAMED :: "51"

    HIDE ¶

    HIDE :: "8"
     

    Not widely supported.

    HVP ¶

    HVP :: "f"
     

    Horizontal Vertical Position

    HYPERLINK :: "8"
     

    Followed by ";[params];<URI>" ST. Closed by OSC HYPERLINK ";;" ST.

    INVERT ¶

    INVERT :: "7"
     

    Also known as reverse video.

    ITALIC ¶

    ITALIC :: "3"
     

    Not widely supported.

    NO_BLINK :: "25"

    NO_BOLD_FAINT ¶

    NO_BOLD_FAINT :: "22"

    NO_FRAME_ENCIRCLE ¶

    NO_FRAME_ENCIRCLE :: "54"

    NO_HIDE ¶

    NO_HIDE :: "28"

    NO_ITALIC_BLACKLETTER ¶

    NO_ITALIC_BLACKLETTER :: "23"

    NO_OVERLINE ¶

    NO_OVERLINE :: "55"

    NO_PROPORTIONAL_SPACING ¶

    NO_PROPORTIONAL_SPACING :: "50"

    NO_REVERSE ¶

    NO_REVERSE :: "27"

    NO_STRIKE ¶

    NO_STRIKE :: "29"

    NO_UNDERLINE ¶

    NO_UNDERLINE :: "24"

    OSC ¶

    OSC :: ESC + "]"
     

    Operating System Command

    OVERLINED ¶

    OVERLINED :: "53"

    PROPORTIONAL_SPACING ¶

    PROPORTIONAL_SPACING :: "26"

    RCP ¶

    RCP :: "u"
     

    Restore Saved Cursor Position

    RESET ¶

    RESET :: "0"

    SCP ¶

    SCP :: "s"
     

    Save Current Cursor Position

    SD ¶

    SD :: "T"
     

    Scroll Down

    SGR ¶

    SGR :: "m"
     

    Select Graphic Rendition

    ST ¶

    ST :: ESC + "\\"
     

    String Terminator

    STRIKE ¶

    STRIKE :: "9"

    SU ¶

    SU :: "S"
     

    Scroll Up

    UNDERLINE ¶

    UNDERLINE :: "4"

    UNDERLINE_DOUBLE ¶

    UNDERLINE_DOUBLE :: "21"
     

    May be interpreted as "disable bold."

    WINDOW_TITLE ¶

    WINDOW_TITLE :: "2"
     

    Followed by ";<text>" ST.

    Variables

    This section is empty.

    Procedures

    This section is empty.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-09 (vendor "odin") Windows_amd64 @ 2024-09-07 21:12:27.290735100 +0000 UTC