Documentation ¶
Index ¶
- Constants
- Variables
- func AltScreen(enable bool) string
- func Bg(color uint8) string
- func BgHex(hex string) string
- func BgRGB(r uint8, g uint8, b uint8) string
- func Contains(text string) bool
- func Count(text string) int
- func Cursor(enable bool) string
- func CursorDown(n int) string
- func CursorLeft(n int) string
- func CursorRight(n int) string
- func CursorUp(n int) string
- func Eprint(args ...any) (int, error)
- func Eprintf(format string, args ...any) (int, error)
- func Eprintln(args ...any) (int, error)
- func Fg(color uint8) string
- func FgHex(hex string) string
- func FgRGB(r uint8, g uint8, b uint8) string
- func FindNext(text string) []int
- func Fprint(w io.Writer, args ...any) (int, error)
- func Fprintf(w io.Writer, format string, args ...any) (int, error)
- func Fprintln(w io.Writer, args ...any) (int, error)
- func Goto(row int, col int) string
- func InclusiveSlice(text string, start int, end int) string
- func IsBright16(color uint8) bool
- func LengthNoAnsi(text string) int
- func LineWrap(enable bool) string
- func Print(args ...any) (int, error)
- func Printf(format string, args ...any) (int, error)
- func Println(args ...any) (int, error)
- func RunePosToByteIndex(text string, runePos int) int
- func ScrollViewport(start int, end int) string
- func SizeNoAnsi(text string) int
- func Slice(text string, start int, end int) string
- func Strip(text string) string
- func Title(title string) string
Constants ¶
View Source
const ( Reset = "\x1b[0m" Bold = "\x1b[1m" Dim = "\x1b[2m" Italic = "\x1b[3m" Underline = "\x1b[4m" Blink = "\x1b[5m" Reverse = "\x1b[7m" Invisible = "\x1b[8m" Crossout = "\x1b[9m" )
View Source
const ( Black = 0 Red = 1 Green = 2 Yellow = 3 Blue = 4 Magenta = 5 Cyan = 6 White = 7 LightBlack = 8 LightRed = 9 LightGreen = 10 LightYellow = 11 LightBlue = 12 LightMagenta = 13 LightCyan = 14 LightWhite = 15 BlackFg = "\x1b[30m" RedFg = "\x1b[31m" GreenFg = "\x1b[32m" YellowFg = "\x1b[33m" BlueFg = "\x1b[34m" MagentaFg = "\x1b[35m" CyanFg = "\x1b[36m" WhiteFg = "\x1b[37m" BlackBg = "\x1b[40m" RedBg = "\x1b[41m" GreenBg = "\x1b[42m" YellowBg = "\x1b[43m" BlueBg = "\x1b[44m" MagentaBg = "\x1b[45m" CyanBg = "\x1b[46m" WhiteBg = "\x1b[47m" LightBlackFg = "\x1b[90m" LightRedFg = "\x1b[91m" LightGreenFg = "\x1b[92m" LightYellowFg = "\x1b[93m" LightBlueFg = "\x1b[94m" LightMagentaFg = "\x1b[95m" LightCyanFg = "\x1b[96m" LightWhiteFg = "\x1b[97m" LightBlackBg = "\x1b[100m" LightRedBg = "\x1b[101m" LightGreenBg = "\x1b[102m" LightYellowBg = "\x1b[103m" LightBlueBg = "\x1b[104m" LightMagentaBg = "\x1b[105m" LightCyanBg = "\x1b[106m" LightWhiteBg = "\x1b[107m" )
View Source
const ( SaveCursor = "\x1b[s" RestoreCursor = "\x1b[u" SaveCursorAttr = "\x1b7" RestoreCursorAttr = "\x1b8" GetCursorPosition = "\x1b[6n" )
View Source
const ( ScrollDown = "\x1bD" ScrollUp = "\x1bM" ScrollScreen = "\x1br" ClearScreen = "\x1b[2J" ClearToScreenStart = "\x1b[1J" ClearToScreenEnd = "\x1b[J" ClearLine = "\x1b[2K" ClearToLineStart = "\x1b[1K" ClearToLineEnd = "\x1b[K" SaveScreen = "\x1b[?47h" RestoreScreen = "\x1b[?47l" )
View Source
const Marker = '\x1b'
View Source
const (
ResetDevice = "\x1bc"
)
Variables ¶
View Source
var Regex = regexp.MustCompile("[\u001b\u009b][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z" +
"\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf" +
"-ntqry=><~]))")
Regex from https://github.com/acarl005/stripansi
Functions ¶
func CursorDown ¶
func CursorLeft ¶
func CursorRight ¶
func Fg ¶
TODO: If terminal does not support truecolor or 256 colors, find the closest supported color
func InclusiveSlice ¶
Include the ansi sequences before the first character
func IsBright16 ¶
func LengthNoAnsi ¶
func RunePosToByteIndex ¶
Convert rune index without ansi sequences to index including ansi sequences
func ScrollViewport ¶
func SizeNoAnsi ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.