ui

package
v0.0.0-...-ba0425c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

This package contains some utility functions for printing reusable UI components, such as progress bars and tables.

Index

Constants

View Source
const (
	FG_BLACK   = "\u001B[30m"
	FG_RED     = "\u001B[31m"
	FG_GREEN   = "\u001B[32m"
	FG_YELLOW  = "\u001B[33m"
	FG_BLUE    = "\u001B[34m"
	FG_MAGENTA = "\u001B[35m"
	FG_CYAN    = "\u001B[36m"
	FG_WHITE   = "\u001B[37m"

	FG_BRIGHT_BLACK   = "\u001B[90m"
	FG_BRIGHT_RED     = "\u001B[91m"
	FG_BRIGHT_GREEN   = "\u001B[92m"
	FG_BRIGHT_YELLOW  = "\u001B[93m"
	FG_BRIGHT_BLUE    = "\u001B[94m"
	FG_BRIGHT_MAGENTA = "\u001B[95m"
	FG_BRIGHT_CYAN    = "\u001B[96m"
	FG_BRIGHT_WHITE   = "\u001B[97m"

	BG_BLACK   = "\u001B[40m"
	BG_RED     = "\u001B[41m"
	BG_GREEN   = "\u001B[42m"
	BG_YELLOW  = "\u001B[43m"
	BG_BLUE    = "\u001B[44m"
	BG_MAGENTA = "\u001B[45m"
	BG_CYAN    = "\u001B[46m"
	BG_WHITE   = "\u001B[47m"

	BG_BRIGHT_BLACK   = "\u001B[100m"
	BG_BRIGHT_RED     = "\u001B[101m"
	BG_BRIGHT_GREEN   = "\u001B[102m"
	BG_BRIGHT_YELLOW  = "\u001B[103m"
	BG_BRIGHT_BLUE    = "\u001B[104m"
	BG_BRIGHT_MAGENTA = "\u001B[105m"
	BG_BRIGHT_CYAN    = "\u001B[106m"
	BG_BRIGHT_WHITE   = "\u001B[107m"

	BOLD = "\u001B[1m"
	DIM  = "\u001B[2m"

	ITALIC              = "\u001B[3m"
	ITALIC_RESET        = "\u001B[23m"
	UNDERLINE           = "\u001B[4m"
	UNDERLINE_RESET     = "\u001b[24m"
	BLINK               = "\u001B[5m"
	BLINK_RESET         = "\u001b[25m"
	REVERSE             = "\u001B[7m"
	REVERSE_RESET       = "\u001b[27m"
	HIDDEN              = "\u001B[8m"
	HIDDEN_RESET        = "\u001b[28m"
	STRIKETHROUGH       = "\u001B[9m"
	STRIKETHROUGH_RESET = "\u001b[29m"

	ERASE_SCREEN              = "\u001B[2J"
	RESET_CURSOR              = "\u001B[H"
	MOVE_CURSOR_TO_LINE_START = "\u001B[1G"

	RESET           = "\u001B[0m"
	RESET_FG        = "\u001B[39m"
	RESET_BG        = "\u001b[49m"
	RESET_INTENSITY = "\u001b[22m"

	HIDE_CURSOR = "\u001B[?25l"
	SHOW_CURSOR = "\u001B[?25h"
)
View Source
const (
	LINE_HORIZONTAL     = "\u2500" // ─
	LINE_VERTICAL       = "\u2502" // │
	CORNER_TOP_LEFT     = "\u250C" // ┌
	CORNER_TOP_RIGHT    = "\u2510" // ┐
	CORNER_BOTTOM_LEFT  = "\u2514" // └
	CORNER_BOTTOM_RIGHT = "\u2518" // ┘
	T_VERTICAL_RIGHT    = "\u251C" // ├
	T_VERTICAL_LEFT     = "\u2524" // ┤
	T_HORIZONTAL_DOWN   = "\u252C" // ┬
	T_HORIZONTAL_UP     = "\u2534" // ┴
	CROSS               = "\u253C" // ┼
	DIAG_UPPER_RIGHT    = "\u2571" // ╱
	DIAG_LOWER_LEFT     = "\u2571" // ╱
	DIAG_UPPER_LEFT     = "\u2572" // ╲
	DIAG_LOWER_RIGHT    = "\u2572" // ╲
	WHITE_QUEEN         = "\u25A0" // ■
	BLACK_QUEEN         = "\u25A0" // ■
	ARROW_SQUARE        = "\u2715" // ✕
	VACANT_SQUARE       = "\u00B7" // ·
)

Variables

This section is empty.

Functions

func BgBlack

func BgBlack(s string) string

func BgBlue

func BgBlue(s string) string

func BgBrightBlack

func BgBrightBlack(s string) string

func BgBrightBlue

func BgBrightBlue(s string) string

func BgBrightCyan

func BgBrightCyan(s string) string

func BgBrightGreen

func BgBrightGreen(s string) string

func BgBrightMagenta

func BgBrightMagenta(s string) string

func BgBrightRed

func BgBrightRed(s string) string

func BgBrightWhite

func BgBrightWhite(s string) string

func BgBrightYellow

func BgBrightYellow(s string) string

func BgCyan

func BgCyan(s string) string

func BgGreen

func BgGreen(s string) string

func BgMagenta

func BgMagenta(s string) string

func BgRed

func BgRed(s string) string

func BgWhite

func BgWhite(s string) string

func BgYellow

func BgYellow(s string) string
func Blink(s string) string

func Bold

func Bold(s string) string

func ClearRect

func ClearRect(row1, row2, col1, col2 int)

ClearRect clears the rectangular region of the terminal defined by the space between (inclusive) the two row number and the two column numbers

func ClearScreen

func ClearScreen()

func Dim

func Dim(s string) string

func FgBlack

func FgBlack(s string) string

func FgBlue

func FgBlue(s string) string

func FgBrightBlack

func FgBrightBlack(s string) string

func FgBrightBlue

func FgBrightBlue(s string) string

func FgBrightCyan

func FgBrightCyan(s string) string

func FgBrightGreen

func FgBrightGreen(s string) string

func FgBrightMagenta

func FgBrightMagenta(s string) string

func FgBrightRed

func FgBrightRed(s string) string

func FgBrightWhite

func FgBrightWhite(s string) string

func FgBrightYellow

func FgBrightYellow(s string) string

func FgCyan

func FgCyan(s string) string

func FgGreen

func FgGreen(s string) string

func FgMagenta

func FgMagenta(s string) string

func FgRed

func FgRed(s string) string

func FgWhite

func FgWhite(s string) string

func FgYellow

func FgYellow(s string) string

func Hidden

func Hidden(s string) string

func HideCursor

func HideCursor()

func Italic

func Italic(s string) string

func MoveCursorDown

func MoveCursorDown(rows int)

func MoveCursorLeft

func MoveCursorLeft(cols int)

func MoveCursorRight

func MoveCursorRight(cols int)

func MoveCursorUp

func MoveCursorUp(rows int)

func Repeat

func Repeat(times int, str string) string

Repeat a string some number of times.

func Reverse

func Reverse(s string) string

func SelectPlayers

func SelectPlayers() (edi.VI, edi.VI)

Prompts the user to select two VIs to play a game and returns them. The first VI should play White and the second should play Black.

func SetCursor

func SetCursor(row, col int)

func ShowCursor

func ShowCursor()

func Strikethrough

func Strikethrough(s string) string

func TerminalSize

func TerminalSize() (width, height int)

func Underline

func Underline(s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL