termcolor

package module
v0.0.0-...-15084bd Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2017 License: MIT Imports: 2 Imported by: 2

README

Really simple library for term colors in golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapedFormat

func EscapedFormat(s string, modes ...Mode) string

EscapedFormat returns a strings formated with modes escaped with (mostly for PS1 usage)

func Format

func Format(s string, modes ...Mode) string

Format returns a strings formated with modes

func GetCode

func GetCode(modes ...Mode) string

GetCode return the term code for modes

func GetEscapedCode

func GetEscapedCode(modes ...Mode) string

GetEscapedCode returns the needed code escaped (mostly for PS1 usage)

Types

type Mode

type Mode int

Mode type is for defining term modes

const (
	TermReset Mode = iota
	Bold
	Faint
	Italic
	Underline
	BlinkSlow
	BlinkRapid
	ReverseVideo
	Concealed
	CrossedOut
)

Constans borrowed from github.com/fatih/color Base attributes

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

Foreground text colors

const (
	FgHiBlack Mode = iota + 90
	FgHiRed
	FgHiGreen
	FgHiYellow
	FgHiBlue
	FgHiMagenta
	FgHiCyan
	FgHiWhite
)

Foreground Hi-Intensity text colors

const (
	BgBlack Mode = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

Background text colors

const (
	BgHiBlack Mode = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)

Background Hi-Intensity text colors

Jump to

Keyboard shortcuts

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