ansi

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableColors = false

DisableColors disables all colors and other ANSI sequences.

View Source
var EnvironmentOverrideColors = true

EnvironmentOverrideColors overs coloring based on `CLICOLOR` and `CLICOLOR_FORCE`. Cf. https://bixense.com/clicolors/

View Source
var ForceColors = false

ForceColors forces the use of colors and other ANSI sequences.

Functions

func Blue added in v0.3.2

func Blue(text string) string

Blue returns text colored blue.

func Bold

func Bold(text string) string

Bold returns bolded text if the writer supports colors.

func BrightRed added in v0.5.1

func BrightRed(text string) string

BrightRed returns text colored bright red.

func BrightYellow added in v0.5.1

func BrightYellow(text string) string

BrightYellow returns text colored bright yellow.

func Color

func Color() aurora.Aurora

Color returns an aurora.Aurora instance with colors enabled or disabled depending on whether the writer supports colors.

func ColorizeJSON

func ColorizeJSON(json string) string

ColorizeJSON returns a colorized version of the input JSON, if the writer supports colors.

func Cyan added in v0.3.2

func Cyan(text string) string

Cyan returns text colored cyan.

func Faint

func Faint(text string) string

Faint returns slightly offset color text if the writer supports it.

func Green added in v0.3.2

func Green(text string) string

Green returns text colored green.

func InitConsole added in v0.4.1

func InitConsole()

InitConsole initializes any platform-specific aspect of the terminal. This method will run for all except Windows.

func Initialize added in v1.0.0

func Initialize(shouldDisableColors bool)

Initialize re-instantiates the Aurora instance This initialization step is necessary because the parsing of the --no-color flag is done fairly late in the application cycle.

func Italic

func Italic(text string) string

Italic returns italicized text if the writer supports it.

func Magenta added in v0.3.2

func Magenta(text string) string

Magenta returns text colored magenta.

func ProgressBar added in v1.4.0

func ProgressBar[T comparable](desc string, items []T, fn func(int, T) error) error

ProgressBar will display progress indication for the given items.

func Red added in v0.3.2

func Red(text string) string

Red returns text colored red.

func Spinner

func Spinner(text string, fn func() error) error

func URL added in v1.1.0

func URL(text string) string

URL formats URL links if the writer supports it.

func Waiting added in v0.3.0

func Waiting(fn func() error) error

func Yellow added in v0.3.2

func Yellow(text string) string

Yellow returns text 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