tfmt

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NoBackground is used to not change the current background color
	NoBackground = BackgroundColor(0)
	// BlackBackground color
	BlackBackground = BackgroundColor(40)
	// RedBackground color
	RedBackground = BackgroundColor(41)
	// GreenBackground color
	GreenBackground = BackgroundColor(42)
	// YellowBackground color
	YellowBackground = BackgroundColor(43)
	// BlueBackground color
	BlueBackground = BackgroundColor(44)
	// PurpleBackground color
	PurpleBackground = BackgroundColor(45)
	// CyanBackground color
	CyanBackground = BackgroundColor(46)
	// GrayBackground color
	GrayBackground = BackgroundColor(47)
)
View Source
const (
	// ResetColors resets foreground and background color
	ResetColors = Color(0)
	// NoColor is used to not change the current color
	NoColor = Color(-1)
	// Black color
	Black = Color(30)
	// Red color
	Red = Color(31)
	// Green color
	Green = Color(32)
	// Yellow color
	Yellow = Color(33)
	// Blue color
	Blue = Color(34)
	// Purple color
	Purple = Color(35)
	// Cyan color
	Cyan = Color(36)
	// Gray color
	Gray = Color(37)
	// DarkGray color (bold Black)
	DarkGray = Color(-30)
	// BrightRed color (bold Red)
	BrightRed = Color(-31)
	// BrightGreen color (bold Green)
	BrightGreen = Color(-32)
	// BrightYellow color (bold Yellow)
	BrightYellow = Color(-33)
	// BrightBlue color (bold Blue)
	BrightBlue = Color(-34)
	// BrightPurple color (bold Purple)
	BrightPurple = Color(-35)
	// BrightCyan color (bold Cyan)
	BrightCyan = Color(-36)
	// White color (bold Gray)
	White = Color(-37)
)
View Source
const (
	// CursorSave stores the current cursor position
	CursorSave = CursorAction(0)
	// CursorRestore restores the cursor position saved by CursorSave
	CursorRestore = CursorAction(1)
	// CursorClearLine clears the rest of the line
	CursorClearLine = CursorAction(2)
	// CursorClearScreen clears the screen and positions the cursor at 0,0
	CursorClearScreen = CursorAction(3)
)

Variables

This section is empty.

Functions

func Colorize

func Colorize(c Color, b BackgroundColor, text string) string

Colorize returns a colored string with the given colors.

func Colorizef

func Colorizef(c Color, b BackgroundColor, format string, args ...interface{}) string

Colorizef returns a colored, formatted string with the given colors.

Types

type BackgroundColor

type BackgroundColor int

BackgroundColor provides ANSI background color support. As Color implements Stringer

you can simply add a color to your print commands like

fmt.Print(BgRed,"Hello world").

func (BackgroundColor) String

func (c BackgroundColor) String() string

String implements the stringer interface for color

type Color

type Color int

Color provides ANSI color support. As Color implements Stringer you can simply add a color to your print commands like fmt.Print(Red,"Hello world").

func (Color) String

func (c Color) String() string

String implements the stringer interface for color

type CursorAction

type CursorAction int

CursorAction provides ANSI cursor management support. As CursorAction implements Stringer you can simply add a it to your print commands.

func (CursorAction) String

func (c CursorAction) String() string

String implements the stringer interface for CursorAction

type CursorDown

type CursorDown int

CursorDown provides ANSI cursor movement support. As CursorDown implements Stringer you can simply add a it to your print commands like fmt.Print(CursorDown(10),"Hello world").

func (CursorDown) String

func (c CursorDown) String() string

String implements the stringer interface for CursorDown

type CursorLeft

type CursorLeft int

CursorLeft provides ANSI cursor movement support. As CursorLeft implements Stringer you can simply add a it to your print commands like fmt.Print(CursorLeft(10),"Hello world").

func (CursorLeft) String

func (c CursorLeft) String() string

String implements the stringer interface for CursorLeft

type CursorPosition

type CursorPosition struct {
	X int
	Y int
}

CursorPosition provides ANSI cursor movement support. As CursorPosition implements Stringer you can simply add a it to your print commands like fmt.Print(CursorPosition{x:0,y:0},"Hello world").

func (CursorPosition) String

func (c CursorPosition) String() string

String implements the stringer interface for CursorPosition

type CursorRight

type CursorRight int

CursorRight provides ANSI cursor movement support. As CursorRight implements Stringer you can simply add a it to your print commands like fmt.Print(CursorRight(10),"Hello world").

func (CursorRight) String

func (c CursorRight) String() string

String implements the stringer interface for CursorRight

type CursorUp

type CursorUp int

CursorUp provides ANSI cursor movement support. As CursorUp implements Stringer you can simply add a it to your print commands like fmt.Print(CursorUp(10),"Hello world").

func (CursorUp) String

func (c CursorUp) String() string

String implements the stringer interface for CursorUp

Jump to

Keyboard shortcuts

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