package core:terminal/ansi

⌘K
Ctrl+K
or
/

    Overview

    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:

    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_BRIGHT_BLACK ¶

    BG_BRIGHT_BLACK :: "100"
     

    Also known as grey.

    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

    BLINK_RAPID :: "6"
     

    Not widely supported.

    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

    DECASB_ENTER ¶

    DECASB_ENTER :: "?1049h"
     

    Alternate Screen Buffer (Enter)

    DECASB_EXIT ¶

    DECASB_EXIT :: "?1049l"
     

    Alternate Screen Buffer (Exit)

    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

    ESC ¶

    ESC :: "\e"
     

    Escape

    FG_BRIGHT_BLACK ¶

    FG_BRIGHT_BLACK :: "90"
     

    Also known as grey.

    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

    FONT_FRAKTUR ¶

    FONT_FRAKTUR :: "20"
     

    Rarely supported.

    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_ITALIC_BLACKLETTER ¶

    NO_ITALIC_BLACKLETTER :: "23"

    NO_PROPORTIONAL_SPACING ¶

    NO_PROPORTIONAL_SPACING :: "50"

    OSC ¶

    OSC :: ESC + "]"
     

    Operating System Command

    PROPORTIONAL_SPACING ¶

    PROPORTIONAL_SPACING :: "26"

    RCP ¶

    RCP :: "u"
     

    Restore Saved Cursor Position

    SCP ¶

    SCP :: "s"
     

    Save Current Cursor Position

    SD ¶

    SD :: "T"
     

    Scroll Down

    SGR ¶

    SGR :: "m"
     

    Select Graphic Rendition

    ST ¶

    ST :: ESC + "\\"
     

    String Terminator

    SU ¶

    SU :: "S"
     

    Scroll Up

    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-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-10 00:25:51.511820200 +0000 UTC