Documentation
¶
Index ¶
- Constants
- Variables
- func Background8Bit(color int) string
- func Background24Bit(r, g, b int) string
- func CursorBackward(n int) string
- func CursorDown(n int) string
- func CursorForward(n int) string
- func CursorHorizontalAbsolute(n int) string
- func CursorNextLineN(n int) string
- func CursorPosition(row, column int) string
- func CursorPreviousLineN(n int) string
- func CursorUp(n int) string
- func Foreground8Bit(color int) string
- func Foreground24Bit(r, g, b int) string
- func ScrollDown(n int) string
- func ScrollDownN(n int) stringdeprecated
- func ScrollUp(n int) string
- func ScrollUpN(n int) stringdeprecated
- func Strip(input string) string
- func StripCodes(input string) stringdeprecated
Constants ¶
const ( ClearFromCursorToEndScreen = csi + "0J" // Clears from the cursor to the end of the screen. ClearFromCursorToBeginScreen = csi + "1J" // Clears from the cursor to the beginning of the screen. ClearScreen = csi + "2J" // Clear the entire screen. ClearToEnd = csi + "K" // Clear from the cursor to the end of the row (line). ClearToBegin = csi + "1K" // Clear from the cursor to the beginning of the row (line). ClearLine = csi + "2K" // Clear the entire row (line). ClearLineReset = ClearLine + csi + "1G" // Clear the entire row (line) and move the cursor to the start of the row (line). )
const ( ANSIBlack = iota ANSIRed ANSIGreen ANSIYellow ANSIBlue ANSIMagenta ANSICyan ANSIWhite ANSIBrightBlack ANSIBrightRed ANSIBrightGreen ANSIBrightYellow ANSIBrightBlue ANSIBrightMagenta ANSIBrightCyan ANSIBrightWhite )
ANSI color codes.
const ( Black = csi + "30m" // Black foreground color. Red = csi + "31m" // Red foreground color. Green = csi + "32m" // Green foreground color. Yellow = csi + "33m" // Yellow foreground color. Blue = csi + "34m" // Blue foreground color. Magenta = csi + "35m" // Magenta foreground color. Cyan = csi + "36m" // Cyan foreground color. White = csi + "37m" // White foreground color. Default = csi + "39m" // Default foreground color. )
const ( BlackBg = csi + "40m" // Black background color. RedBg = csi + "41m" // Red background color. GreenBg = csi + "42m" // Green background color. YellowBg = csi + "43m" // Yellow background color. BlueBg = csi + "44m" // Blue background color. MagentaBg = csi + "45m" // Magenta background color. CyanBg = csi + "46m" // Cyan background color. WhiteBg = csi + "47m" // White background color. DefaultBg = csi + "49m" // Default background color. )
const ( IntenseBlack = csi + "90m" // Intense Black foreground color. IntenseRed = csi + "91m" // Intense Red foreground color. IntenseGreen = csi + "92m" // Intense Green foreground color. IntenseYellow = csi + "93m" // Intense Yellow foreground color. IntenseBlue = csi + "94m" // Intense Blue foreground color. IntenseMagenta = csi + "95m" // Intense Magenta foreground color. IntenseCyan = csi + "96m" // Intense Cyan foreground color. IntenseWhite = csi + "97m" // Intense White foreground color. )
const ( IntenseBlackBg = csi + "100m" // Intense Black background color. IntenseRedBg = csi + "101m" // Intense Red background color. IntenseGreenBg = csi + "102m" // Intense Green background color. IntenseYellowBg = csi + "103m" // Intense Yellow background color. IntenseBlueBg = csi + "104m" // Intense Blue background color. IntenseMagentaBg = csi + "105m" // Intense Magenta background color. IntenseCyanBg = csi + "106m" // Intense Cyan background color. IntenseWhiteBg = csi + "107m" // Intense White background color. )
const ( SaveCursorPos = csi + "s" // Save the cursor position. RestoreCursorPos = csi + "u" // Restore the cursor position. HideCursor = csi + "?25l" // Hide the cursor. ShowCursor = csi + "?25h" // Show the cursor. )
const ( Reset = csi + "0m" // Reset all formatting. Bold = csi + "1m" // Bold or increased intensity. Dim = csi + "2m" // Dim, decreased intensity, or dim. Italic = csi + "3m" // Italicized text. Underline = csi + "4m" // Underlined text. SlowBlink = csi + "5m" // Slow blinking text. RapidBlink = csi + "6m" // Rapid blinking text. Reverse = csi + "7m" // Reversed colors. Not widely supported. Hide = csi + "8m" // Hide text. Not widely supported. Strike = csi + "9m" // Strikethrough text. DoubleUnderline = csi + "21m" // Double underlined text. ResetIntensity = csi + "22m" // Reset bold or faint. ResetItalic = csi + "23m" // Reset italic. ResetUnderline = csi + "24m" // Reset underline. ResetBlink = csi + "25m" // Reset blink. ResetReverse = csi + "27m" // Reset reverse. ResetHide = csi + "28m" // Reset hide. ResetStrike = csi + "29m" // Reset strikethrough. Framed = csi + "51m" // Framed text. Encircled = csi + "52m" // Encircled text. Overlined = csi + "53m" // Overlined text. ResetFramed = csi + "54m" // Reset framed and encircled. ResetOverlined = csi + "55m" // Reset overlined. IdeogramRight = csi + "73m" // Ideogram right underline. // Hidden text. Not widely supported. // // Deprecated: use [Hide] instead. This will be removed in v2.0.0. Hidden = Hide // Faint, decreased intensity, or dim. // // Deprecated: use [Dim] instead. This will be removed in v2.0.0. Faint = Dim // Reset Hidden text. Not widely supported. // // Deprecated: use [ResetHide] instead. This will be removed in v2.0.0. ResetHidden = ResetHide )
Variables ¶
var ( CursorTopLeft = CursorPosition(1, 1) // Move the cursor to the top left corner of screen. CursorLineBegin = CursorHorizontalAbsolute(1) // Move the cursor to beginning of the row (line). CursorNextLine = CursorNextLineN(1) // Move cursor down one row (line). CursorPreviousLine = CursorPreviousLineN(1) // Move cursor up one row (line). )
var ( ScrollUp1 = ScrollUp(1) // Scroll the screen up one row (line). ScrollDown1 = ScrollDown(1) // Scroll the screen down one row (line). )
Functions ¶
func Background8Bit ¶
8-bit background color color must be between 0 and 255 otherwise it will return an empty string.
func Background24Bit ¶
24-bit background color r, g, b must be between 0 and 255 otherwise it will return an empty string.
func CursorBackward ¶
CursorBackward moves the cursor backward n columns. If n is less than 1, it returns an empty string.
func CursorDown ¶
CursorDown moves the cursor down n rows (lines). If n is less than 1, it returns an empty string.
func CursorForward ¶
CursorForward moves the cursor forward n columns. If n is less than 1, it returns an empty string.
func CursorHorizontalAbsolute ¶
CursorHorizontalAbsolute moves the cursor to the nth column. If n is less than 1, it returns an empty string.
func CursorNextLineN ¶
CursorNextLine moves the cursor down n rows (lines). If n is less than 1, it returns an empty string.
func CursorPosition ¶
CursorPosition moves the cursor to the specified position of row (line) and column. If either row or column are less than 1, it returns an empty string.
func CursorPreviousLineN ¶
CursorPreviousLine moves the cursor up n rows (lines). If n is less than 1, it returns an empty string.
func CursorUp ¶
CursorUp moves the cursor up n rows (lines). If n is less than 1, it returns an empty string.
func Foreground8Bit ¶
8-bit foreground color color must be between 0 and 255 otherwise it will return an empty string.
func Foreground24Bit ¶
24-bit foreground color r, g, b must be between 0 and 255 otherwise it will return an empty string.
func ScrollDown ¶ added in v1.0.2
ScrollDown scrolls the screen down n rows (lines). If n is less than 1, it returns an empty string.
func ScrollDownN
deprecated
ScrollDownN scrolls the screen down n rows (lines). If n is less than 1, it returns an empty string.
Deprecated: Use ScrollDown instead. This will be removed in v2.0.0.
func ScrollUp ¶ added in v1.0.2
ScrollUp scrolls the screen up n rows (lines). If n is less than 1, it returns an empty string.
func StripCodes
deprecated
Types ¶
This section is empty.