color

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorEnabled = true

Color is not enabled if false

View Source
var Colors = map[string]string{
	"BOLD": bold, "BD": bold,
	"UNDERLINE": underline, "UE": underline,
	"RESET": reset, "RT": reset,

	"BLACK": black, "BK": black,
	"RED": red, "RD": red,
	"GREEN": green, "GN": green,
	"YELLOW": yellow, "YW": yellow,
	"BLUE": blue, "BE": blue,
	"MAGENTA": magenta, "MA": magenta,
	"CYAN": cyan, "CN": cyan,

	"BBLACK": brightBlack, "BBK": brightBlack,
	"BRED": brightRed, "BRD": brightRed,
	"BGREEN": brightGreen, "BGN": brightGreen,
	"BYELLOW": brightYellow, "BYW": brightYellow,
	"BBLUE": brightBlue, "BBE": brightBlue,
	"BMAGENTA": brightMagenta, "BMA": brightMagenta,
	"BCYAN": brightCyan, "BCN": brightCyan,
}

Map with colors and colors shortcuts.

Contains - Bold, Underline, Reset, Black, Red, Green, Yellow, Blue, Magenta, Cyan, Bright versions of colors and shortcuts (firtst and last letter of color)

All keys is uppercased.

Functions

func ConvertColored

func ConvertColored(text ...string) []string

Convert list of strings to colored strings using Set

func PrintColored

func PrintColored(format string, args ...interface{})

PrintColored prints formatted text with color codes replaced

func PrintlnColored

func PrintlnColored(format string, args ...interface{})

PrintlnColored prints text with color codes replaced and adds newline

func Set

func Set(text string) string

Set applies colors to text using shortcodes like [?RED], [?GREEN], [?BOLD]

Also you can set color using shortcuts - first and last letters of color to set color like [?RD], [?GN], [?BD].

Types

This section is empty.

Jump to

Keyboard shortcuts

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