console

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FgBlack = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
	FgDefault = 39
)
View Source
const (
	BgBlack = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
	BgDefault = 39
)
View Source
const (
	FgLightBlack = iota + 90
	FgLightRed
	FgLightGreen
	FgLightYellow
	FgLightBlue
	FgLightMagenta
	FgLightCyan
	FgLightWhite
)
View Source
const (
	BgLightBlack = iota + 100
	BgLightRed
	BgLightGreen
	BgLightYellow
	BgLightBlue
	BgLightMagenta
	BgLightCyan
	BgLightWhite
)
View Source
const (
	Bold      = 1
	Dim       = 2
	Italic    = 3 // not always supported
	Underline = 4
	Blink     = 5
	Reversed  = 7
	Hide      = 8
)

Variables

shortcuts Example:

fmt.Println(console.Error("something went %s", "wrong"))

Functions

func Color

func Color(colors ...int) string

Color returns the ANSI escaping for the specified foreground and background colors, as well as modifiers Example:

fmt.Println(console.Color(console.FgGreen, console.BgBlue, console.Bold, console.Underline), "Name", console.Reset())

func Colorize

func Colorize(colors ...int) func(s string, args ...any) string

Colorize returns a function analogous to fmt.Sprintf() but with the specified coloring format applied Example:

fmt.Println(console.Colorize(console.BgBlue, console.FgWhite)("the quick brown %s jumps over the lazy dog", "fox"))

func Reset

func Reset() string

Reset returns the ANSI escaping for color reset

Types

This section is empty.

Jump to

Keyboard shortcuts

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