ansi

package
v1.19.4 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

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.

View Source
var HostStderrIsTerminal = true

HostStderrIsTerminal enables color on stderr output when this package is used in a plugin.

View Source
var HostStdoutIsTerminal = true

HostStdoutIsTerminal enables color on stdout output when this package is used in a plugin.

Functions

func Bold added in v0.2.1

func Bold(text string) string

Bold returns bolded text if the writer supports colors

func Color

func Color(w io.Writer) 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, darkStyle bool, w io.Writer) string

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

func ColorizeStatus added in v0.6.3

func ColorizeStatus(status int) aurora.Value

ColorizeStatus returns a colorized number for HTTP status code

func Faint added in v0.2.1

func Faint(text string) string

Faint returns slightly offset color text if the writer supports it

func Italic added in v0.2.1

func Italic(text string) string

Italic returns italicized text if the writer supports it.

func Linkify

func Linkify(text, url string, w io.Writer) string

Linkify returns an ANSI escape sequence with an hyperlink, if the writer supports colors.

func StartNewSpinner added in v1.4.3

func StartNewSpinner(msg string, w io.Writer) *spinner.Spinner

StartNewSpinner starts a new spinner with the given message. If the writer is not a terminal or doesn't support colors, it simply prints the message.

func StartSpinner

func StartSpinner(s *spinner.Spinner, msg string, w io.Writer)

StartSpinner updates an existing spinner's message, and starts it if it was stopped

func StopSpinner

func StopSpinner(s *spinner.Spinner, msg string, w io.Writer)

StopSpinner stops a spinner with the given message. If the writer is not a terminal or doesn't support colors, it simply prints the message.

func StrikeThrough added in v0.5.2

func StrikeThrough(text string) string

StrikeThrough returns struck though text if the writer supports colors

Types

This section is empty.

Jump to

Keyboard shortcuts

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