terminal

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlackColor color
	BlackColor = iota
	// RedColor color
	RedColor
	// GreenColor color
	GreenColor
	// YellowColor color
	YellowColor
	// BlueColor color
	BlueColor
	// MagentaColor color
	MagentaColor
	// CyanColor color
	CyanColor
	// WhiteColor color
	WhiteColor
)
View Source
const ResetSequence = "\033[0m"

ResetSequence reset ANSI sequence.

Variables

This section is empty.

Functions

func CalculateIncrementalUpdate

func CalculateIncrementalUpdate(output *bufio.Writer, linesBefore []string, linesAfter []string)

CalculateIncrementalUpdate will update the output frame to output. the linesBefore is the prevoius frame, and the linesAfter is the newer frame waiting to output

func CalculateIncrementalUpdateMaxLines

func CalculateIncrementalUpdateMaxLines(output *bufio.Writer, linesBefore []string, linesAfter []string, maxLines int)

CalculateIncrementalUpdateMaxLines will update frames to output with lines limitation.

The linesBefore is the prevoius frame, and the linesAfter is the newer frames waiting to output. The maxLines is the maximum lines allowed to output.

func GetColorSequence

func GetColorSequence(code int) string

GetColorSequence will returns color control escape sequence

func GetColoredText

func GetColoredText(color int, text string) string

GetColoredText will colorize text with color

Types

type ColorSchema

type ColorSchema struct {
	SuccessColor int
	FailureColor int
	NeutralColor int
}

ColorSchema contains success/failure/neutral color

func DefaultColorSchema

func DefaultColorSchema() *ColorSchema

DefaultColorSchema will returns a color schema

By default, success color is green, failure color is red, and neutral color is yellow

Jump to

Keyboard shortcuts

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