Documentation ¶
Index ¶
- Variables
- func ASCIIOnce() int
- func AttributeAndColor(attr, name string) string
- func AttributeOrColor(name string) string
- func BrightColor(text, color string) string
- func Clear()
- func ColorNum(colorNum int) string
- func Colors() []string
- func Commands() []string
- func DarkColor(text, color string) string
- func Do(command string)
- func Down(n uint)
- func Get(command string, replacemap map[string]string) string
- func Home()
- func KeyCodeOnce() int
- func KeyOnce() int
- func Left(n uint)
- func NoColor() string
- func Reset()
- func Right(n uint)
- func Set(command string, replacemap map[string]string)
- func SetAttribute(name string)
- func SetAttributeAndColor(attr, name string)
- func SetColorNum(colorNum int)
- func SetLineWrap(enable bool)
- func SetNoColor()
- func SetXY(x, y uint)
- func ShowCursor(enable bool)
- func TermSize() (uint, uint, error)
- func Up(n uint)
- type AttributeColor
- type Canvas
- func (c *Canvas) At(x, y uint) (rune, error)
- func (c *Canvas) Clear()
- func (c *Canvas) Draw()
- func (c *Canvas) H() uint
- func (c *Canvas) Plot(x, y uint, s rune)
- func (c *Canvas) PlotC(x, y uint, fg string, s rune)
- func (c *Canvas) PlotDC(x, y uint, fg string, s rune)
- func (c *Canvas) Redraw()
- func (c *Canvas) Resize()
- func (c *Canvas) Resized() *Canvas
- func (c *Canvas) Size() (uint, uint)
- func (c *Canvas) String() string
- func (c *Canvas) W() uint
- type Char
- type TTY
Constants ¶
This section is empty.
Variables ¶
var ( Black = &AttributeColor{"Dark", "Black"} Red = &AttributeColor{"Dark", "Red"} Green = &AttributeColor{"Dark", "Green"} Yellow = &AttributeColor{"Dark", "Yellow"} Blue = &AttributeColor{"Dark", "Blue"} Magenta = &AttributeColor{"Dark", "Magenta"} Cyan = &AttributeColor{"Dark", "Cyan"} LightGray = &AttributeColor{"Dark", "White"} DarkGray = &AttributeColor{"Bright", "Black"} LightRed = &AttributeColor{"Bright", "Red"} LightGreen = &AttributeColor{"Bright", "Green"} LightYellow = &AttributeColor{"Bright", "Yellow"} LightBlue = &AttributeColor{"Bright", "Blue"} LightMagenta = &AttributeColor{"Bright", "Magenta"} LightCyan = &AttributeColor{"Bright", "Cyan"} White = &AttributeColor{"Bright", "White"} Pink = LightMagenta Gray = DarkGray )
Functions ¶
func AttributeAndColor ¶
Get the terminal command for setting a terminal attribute and a color
func AttributeOrColor ¶
Execute the terminal command for setting a given display attribute name, like "Bright" or "Blink"
func BrightColor ¶
Return text with a bright color applied
func Get ¶
Return the terminal command, given a map to replace the values mentioned in the spec. If "dummy" is true, the terminal command will be printed instead of executed.
func KeyCodeOnce ¶ added in v0.2.1
func KeyCodeOnce() int
func NoColor ¶
func NoColor() string
Get the terminal command for setting no colors or other display attributes
func Set ¶
Do the terminal command, given a map to replace the values mentioned in the spec. If "dummy" is true, the terminal command will be printed instead of executed.
func SetAttribute ¶
func SetAttribute(name string)
Execute the terminal command for setting a given display attribute name, like "Bright" or "Blink"
func SetAttributeAndColor ¶
func SetAttributeAndColor(attr, name string)
Execute the terminal command for setting a terminal attribute and a color
func SetColorNum ¶
func SetColorNum(colorNum int)
Execute the terminal command for setting a given color number
func SetLineWrap ¶
func SetLineWrap(enable bool)
func SetNoColor ¶
func SetNoColor()
Execute the terminal command for setting no colors or other display attributes
func SetXY ¶
func SetXY(x, y uint)
Move cursor to the given position (from 0 and up, the terminal code is from 1 and up)
func ShowCursor ¶
func ShowCursor(enable bool)
Types ¶
type AttributeColor ¶ added in v0.3.0
type AttributeColor struct {
// contains filtered or unexported fields
}
func (*AttributeColor) Get ¶ added in v0.3.0
func (ac *AttributeColor) Get(text string) string
func (*AttributeColor) Output ¶ added in v0.3.0
func (ac *AttributeColor) Output(text string)
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
func (*Canvas) At ¶ added in v0.2.1
At returns the rune at the given coordinates, or an error if out of bounds
func (*Canvas) Resized ¶
Check if the canvas was resized, and adjust values accordingly. Returns a new canvas, or nil.
type TTY ¶ added in v0.2.1
type TTY struct {
// contains filtered or unexported fields
}
func (*TTY) Close ¶ added in v0.2.1
func (tty *TTY) Close()
Close will Restore and close the raw terminal
func (*TTY) NoBlock ¶ added in v0.2.1
func (tty *TTY) NoBlock()
NoBlock leaves "cooked" mode and enters "cbreak" mode
func (*TTY) RawMode ¶ added in v0.2.1
func (tty *TTY) RawMode()
RawMode will switch the terminal to raw mode
func (*TTY) SetTimeout ¶ added in v0.2.1
SetTimeout sets a timeout for reading a key