colorstring

package module
v0.0.0-...-da7ce7b Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultColors map[string]string

DefaultColors are the default colors used when colorizing.

If the color is surrounded in underscores, such as "_blue_", then that color will be used for the background color.

Functions

func BlackString

func BlackString(str string) string

func BlueString

func BlueString(str string) string

func CyanString

func CyanString(str string) string

func GreenString

func GreenString(str string) string

func GreyString

func GreyString(str string) string

func HiBlueString

func HiBlueString(str string) string

func HiCyanString

func HiCyanString(str string) string

func HiGreenString

func HiGreenString(str string) string

func HiGreyString

func HiGreyString(str string) string

func HiMagentaString

func HiMagentaString(str string) string

func HiRedString

func HiRedString(str string) string

func HiYellowString

func HiYellowString(str string) string

func MagentaString

func MagentaString(str string) string

func RedString

func RedString(str string) string

func WhiteString

func WhiteString(str string) string

func YellowString

func YellowString(str string) string

Types

type Colorize

type Colorize struct {
	// Colors maps a color string to the code for that color. The code
	// is a string so that you can use more complex colors to set foreground,
	// background, attributes, etc. For example, "boldblue" might be
	// "1;34"
	Colors map[string]string

	// If true, color attributes will be ignored. This is useful if you're
	// outputting to a location that doesn't support colors and you just
	// want the strings returned.
	Disable bool

	// Reset, if true, will reset the color after each colorization by
	// adding a reset code at the end.
	Reset bool
}

Colorize colorizes your strings, giving you the ability to customize some of the colorization process.

The options in Colorize can be set to customize colorization. If you're only interested in the defaults, just use the top Color function directly, which creates a default Colorize.

Jump to

Keyboard shortcuts

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