tui

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: GPL-3.0 Imports: 6 Imported by: 860

Documentation

Overview

Package tui contains a set of helper objects and functions for terminal based user interfaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	// effects
	BOLD  = "\033[1m"
	DIM   = "\033[2m"
	RESET = "\033[0m"
	// colors
	RED    = "\033[31m"
	GREEN  = "\033[32m"
	BLUE   = "\033[34m"
	YELLOW = "\033[33m"
	// foreground colors
	FOREBLACK = "\033[30m"
	FOREWHITE = "\033[97m"
	// background colors
	BACKDARKGRAY  = "\033[100m"
	BACKRED       = "\033[41m"
	BACKGREEN     = "\033[42m"
	BACKYELLOW    = "\033[43m"
	BACKLIGHTBLUE = "\033[104m"
)

https://misc.flogisoft.com/bash/tip_colors_and_formatting

Functions

func Blue

func Blue(s string) string

Blue makes the string Green.

func Bold

func Bold(s string) string

Bold makes the string Bold.

func Dim

func Dim(s string) string

Dim makes the string Diminished.

func Disable

func Disable()

Disable will disable all colors and effects.

func Effects

func Effects() bool

Effects returns true if colors and effects are supported on the current terminal.

func Green

func Green(s string) string

Green makes the string Green.

func HasEffect

func HasEffect(s string) bool

HasEffect returns true if the string has any shell control codes in it.

func Red

func Red(s string) string

Red makes the string Red.

func Table

func Table(w io.Writer, columns []string, rows [][]string)

Table accepts a slice of column labels and a 2d slice of rows and prints on the writer an ASCII based datagrid of such data.

func Wrap

func Wrap(e, s string) string

Wrap wraps a string with an effect or color and appends a reset control code.

func Yellow

func Yellow(s string) string

Yellow makes the string Green.

Types

This section is empty.

Jump to

Keyboard shortcuts

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