decorators

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor uint8

Anchor describes the layout of a decorator - i.e. whether it should render at the top/bottom of the terminal

const (
	// AnchorTop renders at the top of the terminal
	AnchorTop Anchor = iota
	// AnchorBottom renders at the bottom of the terminal
	AnchorBottom
)

type Decorator

type Decorator interface {
	Draw(rows uint16, cols uint16, output func(data []byte)) // Draw renders the decorator to StdOut
	GetAnchor() Anchor                                       // GetAnchor returns the anchor e.g. Top/Bottom
	GetHeight() (rows uint16)                                // GetHeight returns the height of the decorator in terminal character rows
	IsVisible() bool
}

Decorator is an entity which modifies the terminal output in a desirable way

type StatusBar

type StatusBar struct {
	// contains filtered or unexported fields
}

StatusBar is a full width bar containing useful info which can be added to the terminal using a proxy

func NewStatusBar

func NewStatusBar() *StatusBar

NewStatusBar creates a new status bar instance

func (*StatusBar) Draw

func (b *StatusBar) Draw(rows uint16, cols uint16, writeFunc func(data []byte))

Draw renders the decorator to StdOut

func (*StatusBar) GetAnchor

func (b *StatusBar) GetAnchor() Anchor

GetAnchor returns the anchor e.g. Top/Bottom

func (*StatusBar) GetHeight

func (b *StatusBar) GetHeight() (rows uint16)

GetHeight returns the height of the decorator in terminal character rows

func (*StatusBar) IsVisible added in v0.0.18

func (b *StatusBar) IsVisible() bool

func (*StatusBar) SetBg

func (b *StatusBar) SetBg(colour ansi.Colour)

SetBg sets the background colour of the status bar

func (*StatusBar) SetFg

func (b *StatusBar) SetFg(colour ansi.Colour)

SetFg sets the background colour of the status bar

func (*StatusBar) SetFormat

func (b *StatusBar) SetFormat(format string)

SetFormat controls the output format of the status bar

func (*StatusBar) SetPadding

func (b *StatusBar) SetPadding(pad uint16)

SetPadding sets a vertical padding on the status bar

func (*StatusBar) SetVisible added in v0.0.18

func (b *StatusBar) SetVisible(visible bool)

Jump to

Keyboard shortcuts

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