color

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package color provides functionality to displayed colored text on the terminal.

Index

Constants

This section is empty.

Variables

View Source
var (
	Grey     = color.New(color.FgWhite)
	DarkGray = color.New(color.FgBlack)
	Red      = color.New(color.FgHiRed)
	DullRed  = color.New(color.FgRed)
	Green    = color.New(color.FgHiGreen)
	Yellow   = color.New(color.FgHiYellow)
	Magenta  = color.New(color.FgMagenta)
	Blue     = color.New(color.FgHiBlue)

	DullGreen   = color.New(color.FgGreen)
	DullBlue    = color.New(color.FgBlue)
	DullYellow  = color.New(color.FgYellow)
	DullMagenta = color.New(color.FgMagenta)
	DullCyan    = color.New(color.FgCyan)

	HiBlue       = color.New(color.FgHiBlue)
	Cyan         = color.New(color.FgHiCyan)
	Bold         = color.New(color.Bold)
	Faint        = color.New(color.Faint)
	BoldFgYellow = color.New(color.FgYellow).Add(color.Bold)
)

Predefined colors. Refer to https://en.wikipedia.org/wiki/ANSI_escape_code to validate if colors would be visible on white or black screen backgrounds.

Functions

func ColorGenerator added in v1.30.0

func ColorGenerator() func() *color.Color

ColorGenerator returns a generator function for colors. It doesn't return reds to avoid error-like formatting.

func DisableColorBasedOnEnvVar

func DisableColorBasedOnEnvVar()

DisableColorBasedOnEnvVar determines whether the CLI will produce color output based on the environment variable, COLOR.

func Emphasize

func Emphasize(s string) string

Emphasize colors the string to denote that it as important, and returns it.

func Help

func Help(s string) string

Help colors the string to denote that it's auxiliary helpful information, and returns it.

func HighlightCode

func HighlightCode(s string) string

HighlightCode wraps the string s with the ` character, colors it to denote it's code, and returns it.

func HighlightCodeBlock added in v1.13.0

func HighlightCodeBlock(s string) string

HighlightCodeBlock wraps the string s with ``` characters, colors it to denote it's a multi-line code block, and returns it.

func HighlightResource

func HighlightResource(s string) string

HighlightResource colors the string to denote it as a resource created by the CLI, and returns it.

func HighlightUserInput

func HighlightUserInput(s string) string

HighlightUserInput colors the string to denote it as an input from standard input, and returns it.

func Prod

func Prod(s string) string

Prod colors the string to mark it is a prod environment.

Types

This section is empty.

Jump to

Keyboard shortcuts

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