term

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FgBlack = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Forground colors

View Source
const (
	Reset = iota
	Bold
	Faint
	Italic
	Underlined
	BlinkSlow
	BlinkFast
	Inverted
	Hidden
	CrossedOut
)

Format modifiers

Variables

View Source
var (
	// Output is the default output for the terminal package
	Output io.Writer
)

Functions

func Blue

func Blue(s string) string

Blue returns s but colored blue

func Color256

func Color256(code uint8, s string) string

Color256 outputs s in the 256 color format.

func ColorPrintf added in v0.0.4

func ColorPrintf(format string, v ...interface{})

ColorPrintf is the same as Colorf except it prints the result to standar out.

func Colorf

func Colorf(format string, a ...interface{}) string

Colorf will generate a formatted string based on color format codes, so basically fmt.Sprintf but for terminal colors.

Syntax:

%[modifier]<forground>

Forground Colors:

%r - red
%g - green
%y - yellow
%b - blue
%m - magenta
%c - cyan
%w - white
%0 - reset (no op)

Modifiers:

%!r - red bold
%.r - red faint
%'r - red italic
%_r - red underlined
%?r - red inverted
% r - red hidden
%-r - red crossed out

func CursorOff

func CursorOff()

CursorOff turns the cursor off

func CursorOn

func CursorOn()

CursorOn turns the cursor on

func Green

func Green(s string) string

Green returns s but colored green

func Red

func Red(s string) string

Red returns s but colored red

func Yellow

func Yellow(s string) string

Yellow returns s but colored yellow

Types

This section is empty.

Jump to

Keyboard shortcuts

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