ansi

package
v0.0.0-...-a7a3610 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Colorize

func Colorize(text string) string

Colorize processes all colors in a given text block and returns a new string with all readable codes translated to ANSI codes.

func ColorizeWithCode

func ColorizeWithCode(key, text string) string

ColorizeWithCode takes a color code and text string and returns the string with the appropriate color codes in it.

func ColorizeWithFallback

func ColorizeWithFallback(text string, fallback bool) string

ColorizeWithFallback will replace xterm color choices with their fallback colors if false is passed in place of fallback

func ColorizeWithFallbackCode

func ColorizeWithFallbackCode(key, text string, fallback bool) string

ColorizeWithFallbackCode takes a color code and text string and returns the string with the appropriate color codes in it.

func Escape

func Escape(text string) string

Escape will replace all ANSI escape codes with text equivalents so strings can be printed with color codes.

func FallbackColor

func FallbackColor(code string) string

FallbackColor takes a code for a given xterm value and then returns the best ANSI match for it.

func Purge

func Purge(text string) string

Purge will remove color codes from the given string.

Types

type ColorizeFunc

type ColorizeFunc func(string) string

ColorizeFunc is a function that takes a string and returns a string with ANSI color escape codes in it.

Jump to

Keyboard shortcuts

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