Documentation ¶
Index ¶
- Variables
- type Attribute
- type Renderer
- func (r *Renderer) End()
- func (r *Renderer) MoveCursor(row, col int)
- func (r *Renderer) NewAttribute(attributes ...Attribute) Attribute
- func (r *Renderer) Refresh()
- func (r *Renderer) Set(row, col int, value rune)
- func (r *Renderer) SetAttribute(attribute Attribute)
- func (r *Renderer) SetDefaultAttribute(attribute Attribute)
- func (r *Renderer) SetString(row, col int, value string)
- func (r *Renderer) Start()
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NORMAL = Attribute("\033[0m") BOLD = Attribute("\033[1m") FAINT = Attribute("\033[2m") ITALIC = Attribute("\033[3m") UNDERLINE = Attribute("\033[4m") SLOW_BLINK = Attribute("\033[5m") FAST_BLINK = Attribute("\033[6m") REVERSE = Attribute("\033[7m") STRIKE = Attribute("\033[8m") BLACK = Attribute("\033[30m") RED = Attribute("\033[31m") GREEN = Attribute("\033[32m") YELLOW = Attribute("\033[33m") BLUE = Attribute("\033[34m") MAGENTA = Attribute("\033[35m") CYAN = Attribute("\033[36m") WHITE = Attribute("\033[37m") BG_BLACK = Attribute("\033[40m") BG_RED = Attribute("\033[41m") BG_GREEN = Attribute("\033[42m") BG_YELLOW = Attribute("\033[43m") BG_BLUE = Attribute("\033[44m") BG_MAGENTA = Attribute("\033[45m") BG_CYAN = Attribute("\033[46m") BG_WHITE = Attribute("\033[47m") )
Functions ¶
This section is empty.
Types ¶
type Attribute ¶ added in v0.3.0
type Attribute []byte
Type representing the style of the text being written (e.g. color, font weight). Internally, just command sequences (a.k.a. ANSI escape codes).
func TrueColorBg ¶
Creates an attribute that sets the background to the RGB value.
type Renderer ¶
type Renderer struct { Lines [][]rune // (RO) The virtual output characters. Attributes [][]Attribute // (RO) The virtual output Attributes. Rows int // (RO) The amount of rows in virtual output. Cols int // (RO) The amount of columns in virtual output. CursorRow int // (RO) The row the cursor is in the terminal. CursorCol int // (RO) The column the cursor is in the terminal. CurrentAttribute Attribute // (RO) The terminal's current attribute. DefaultAttribute Attribute // (RO) The preferred default attribute of the renderer. Out io.Writer // (RO) The default writer to send terminal data to. In io.Reader // (RO) The default reader to get data from. }
Gives an abstraction to render text in any position in the terminal.
func New ¶
Creates a new Renderer using in (e.g. os.Stdin) as input and out (e.g. os.Stdout) as output.
func (*Renderer) MoveCursor ¶
Moves terminal cursor to a position (0 indexed).
func (*Renderer) NewAttribute ¶ added in v0.3.0
Creates a new attribute based on the default attribute.
func (*Renderer) Refresh ¶
func (r *Renderer) Refresh()
Redraws virtual output to the terminal, handling resizes.
func (*Renderer) SetAttribute ¶
Sets the Attribute of the text being written.
func (*Renderer) SetDefaultAttribute ¶
Sets the preferred Attribute with which to prepend new ones.
Click to show internal directories.
Click to hide internal directories.