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: string : "4i"
     

    AUX Port Off

    AUX_ON ¶

    AUX_ON: string : "5i"
     

    AUX Port On

    BEL ¶

    BEL: string : "\a"
     

    Bell

    BG_BLACK ¶

    BG_BLACK: string : "40"

    BG_BLUE ¶

    BG_BLUE: string : "44"

    BG_BRIGHT_BLACK ¶

    BG_BRIGHT_BLACK: string : "100"
     

    Also known as grey.

    BG_BRIGHT_BLUE ¶

    BG_BRIGHT_BLUE: string : "104"

    BG_BRIGHT_CYAN ¶

    BG_BRIGHT_CYAN: string : "106"

    BG_BRIGHT_GREEN ¶

    BG_BRIGHT_GREEN: string : "102"

    BG_BRIGHT_MAGENTA ¶

    BG_BRIGHT_MAGENTA: string : "105"

    BG_BRIGHT_RED ¶

    BG_BRIGHT_RED: string : "101"

    BG_BRIGHT_WHITE ¶

    BG_BRIGHT_WHITE: string : "107"

    BG_BRIGHT_YELLOW ¶

    BG_BRIGHT_YELLOW: string : "103"

    BG_COLOR ¶

    BG_COLOR: string : "48"

    BG_COLOR_24_BIT ¶

    BG_COLOR_24_BIT: string : "48;2"
     

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

    BG_COLOR_8_BIT ¶

    BG_COLOR_8_BIT: string : "48;5"
     

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

    BG_CYAN ¶

    BG_CYAN: string : "46"

    BG_DEFAULT ¶

    BG_DEFAULT: string : "49"

    BG_GREEN ¶

    BG_GREEN: string : "42"

    BG_MAGENTA ¶

    BG_MAGENTA: string : "45"

    BG_RED ¶

    BG_RED: string : "41"

    BG_WHITE ¶

    BG_WHITE: string : "47"

    BG_YELLOW ¶

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

    Not widely supported.

    BLINK_SLOW: string : "5"

    BOLD ¶

    BOLD: string : "1"

    BS ¶

    BS: string : "\b"
     

    Backspace

    CHA ¶

    CHA: string : "G"
     

    Cursor Horizontal Absolute

    CLIPBOARD ¶

    CLIPBOARD: string : "52"
     

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

    CNL ¶

    CNL: string : "E"
     

    Cursor Next Line

    CPL ¶

    CPL: string : "F"
     

    Cursor Previous Line

    CSI ¶

    CSI: string : ESC + "["
     

    Control Sequence Introducer

    CUB ¶

    CUB: string : "D"
     

    Cursor Back

    CUD ¶

    CUD: string : "B"
     

    Cursor Down

    CUF ¶

    CUF: string : "C"
     

    Cursor Forward

    CUP ¶

    CUP: string : "H"
     

    Cursor Position

    CUU ¶

    CUU: string : "A"
     

    Cursor Up

    DECAWM_OFF ¶

    DECAWM_OFF: string : "?7l"
     

    Auto Wrap Mode (Disabled)

    DECAWM_ON ¶

    DECAWM_ON: string : "?7h"
     

    Auto Wrap Mode (Enabled)

    DECRC ¶

    DECRC: string : ESC + "8"
     

    DEC Restore Cursor

    DECSC ¶

    DECSC: string : ESC + "7"
     

    DEC Save Cursor

    DECTCEM_HIDE ¶

    DECTCEM_HIDE: string : "?25l"
     

    Text Cursor Enable Mode (Invisible)

    DECTCEM_SHOW ¶

    DECTCEM_SHOW: string : "?25h"
     

    Text Cursor Enable Mode (Visible)

    DSR ¶

    DSR: string : "6n"
     

    Device Status Report

    ED ¶

    ED: string : "J"
     

    Erase in Display

    EL ¶

    EL: string : "K"
     

    Erase in Line

    ENCIRCLED ¶

    ENCIRCLED: string : "52"

    ESC ¶

    ESC: string : "\e"
     

    Escape

    FAINT ¶

    FAINT: string : "2"

    FG_BLACK ¶

    FG_BLACK: string : "30"

    FG_BLUE ¶

    FG_BLUE: string : "34"

    FG_BRIGHT_BLACK ¶

    FG_BRIGHT_BLACK: string : "90"
     

    Also known as grey.

    FG_BRIGHT_BLUE ¶

    FG_BRIGHT_BLUE: string : "94"

    FG_BRIGHT_CYAN ¶

    FG_BRIGHT_CYAN: string : "96"

    FG_BRIGHT_GREEN ¶

    FG_BRIGHT_GREEN: string : "92"

    FG_BRIGHT_MAGENTA ¶

    FG_BRIGHT_MAGENTA: string : "95"

    FG_BRIGHT_RED ¶

    FG_BRIGHT_RED: string : "91"

    FG_BRIGHT_WHITE ¶

    FG_BRIGHT_WHITE: string : "97"

    FG_BRIGHT_YELLOW ¶

    FG_BRIGHT_YELLOW: string : "93"

    FG_COLOR ¶

    FG_COLOR: string : "38"

    FG_COLOR_24_BIT ¶

    FG_COLOR_24_BIT: string : "38;2"
     

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

    FG_COLOR_8_BIT ¶

    FG_COLOR_8_BIT: string : "38;5"
     

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

    FG_CYAN ¶

    FG_CYAN: string : "36"

    FG_DEFAULT ¶

    FG_DEFAULT: string : "39"

    FG_GREEN ¶

    FG_GREEN: string : "32"

    FG_MAGENTA ¶

    FG_MAGENTA: string : "35"

    FG_RED ¶

    FG_RED: string : "31"

    FG_WHITE ¶

    FG_WHITE: string : "37"

    FG_YELLOW ¶

    FG_YELLOW: string : "33"

    FONT_ALT1 ¶

    FONT_ALT1: string : "11"

    FONT_ALT2 ¶

    FONT_ALT2: string : "12"

    FONT_ALT3 ¶

    FONT_ALT3: string : "13"

    FONT_ALT4 ¶

    FONT_ALT4: string : "14"

    FONT_ALT5 ¶

    FONT_ALT5: string : "15"

    FONT_ALT6 ¶

    FONT_ALT6: string : "16"

    FONT_ALT7 ¶

    FONT_ALT7: string : "17"

    FONT_ALT8 ¶

    FONT_ALT8: string : "18"

    FONT_ALT9 ¶

    FONT_ALT9: string : "19"

    FONT_FRAKTUR ¶

    FONT_FRAKTUR: string : "20"
     

    Rarely supported.

    FONT_PRIMARY ¶

    FONT_PRIMARY: string : "10"

    FRAMED ¶

    FRAMED: string : "51"

    HIDE ¶

    HIDE: string : "8"
     

    Not widely supported.

    HVP ¶

    HVP: string : "f"
     

    Horizontal Vertical Position

    HYPERLINK: string : "8"
     

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

    INVERT ¶

    INVERT: string : "7"
     

    Also known as reverse video.

    ITALIC ¶

    ITALIC: string : "3"
     

    Not widely supported.

    NO_BLINK: string : "25"

    NO_BOLD_FAINT ¶

    NO_BOLD_FAINT: string : "22"

    NO_FRAME_ENCIRCLE ¶

    NO_FRAME_ENCIRCLE: string : "54"

    NO_HIDE ¶

    NO_HIDE: string : "28"

    NO_ITALIC_BLACKLETTER ¶

    NO_ITALIC_BLACKLETTER: string : "23"

    NO_OVERLINE ¶

    NO_OVERLINE: string : "55"

    NO_PROPORTIONAL_SPACING ¶

    NO_PROPORTIONAL_SPACING: string : "50"

    NO_REVERSE ¶

    NO_REVERSE: string : "27"

    NO_STRIKE ¶

    NO_STRIKE: string : "29"

    NO_UNDERLINE ¶

    NO_UNDERLINE: string : "24"

    OSC ¶

    OSC: string : ESC + "]"
     

    Operating System Command

    OVERLINED ¶

    OVERLINED: string : "53"

    PROPORTIONAL_SPACING ¶

    PROPORTIONAL_SPACING: string : "26"

    RCP ¶

    RCP: string : "u"
     

    Restore Saved Cursor Position

    RESET ¶

    RESET: string : "0"

    SCP ¶

    SCP: string : "s"
     

    Save Current Cursor Position

    SD ¶

    SD: string : "T"
     

    Scroll Down

    SGR ¶

    SGR: string : "m"
     

    Select Graphic Rendition

    ST ¶

    ST: string : ESC + "\\"
     

    String Terminator

    STRIKE ¶

    STRIKE: string : "9"

    SU ¶

    SU: string : "S"
     

    Scroll Up

    UNDERLINE ¶

    UNDERLINE: string : "4"

    UNDERLINE_DOUBLE ¶

    UNDERLINE_DOUBLE: string : "21"
     

    May be interpreted as "disable bold."

    WINDOW_TITLE ¶

    WINDOW_TITLE: string : "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-2025-03 (vendor "odin") Windows_amd64 @ 2025-03-25 21:11:15.173309900 +0000 UTC