color

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NamedColorMap = map[string]string{
	"red":       "#FF0000",
	"blue":      "#0000FF",
	"green":     "#008000",
	"yellow":    "#FFFF00",
	"orange":    "#FFA500",
	"purple":    "#800080",
	"pink":      "#FFC0CB",
	"cyan":      "#00FFFF",
	"magenta":   "#FF00FF",
	"lime":      "#00FF00",
	"teal":      "#008080",
	"navy":      "#000080",
	"maroon":    "#800000",
	"olive":     "#808000",
	"silver":    "#C0C0C0",
	"gray":      "#808080",
	"grey":      "#808080",
	"black":     "#000000",
	"white":     "#FFFFFF",
	"darkgray":  "#A9A9A9",
	"darkgrey":  "#A9A9A9",
	"lightgray": "#D3D3D3",
	"lightgrey": "#D3D3D3",
	"gold":      "#FFD700",
	"brown":     "#A52A2A",
	"coral":     "#FF7F50",
	"crimson":   "#DC143C",
	"indigo":    "#4B0082",
	"ivory":     "#FFFFF0",
	"khaki":     "#F0E68C",
	"lavender":  "#E6E6FA",
	"salmon":    "#FA8072",
	"tan":       "#D2B48C",
	"tomato":    "#FF6347",
	"violet":    "#EE82EE",
	"wheat":     "#F5DEB3",
}

NamedColorMap maps HTML color names to hex codes

Functions

func ColorizeText

func ColorizeText(text, hex string) string

ColorizeText returns ANSI escape sequence for colored text

func DisableColors

func DisableColors()

DisableColors disables colored output globally

func FormatColoredTag

func FormatColoredTag(tag, hex string) string

FormatColoredTag returns a formatted string with colored indicator

func Gray

func Gray(text string) string

Gray returns ANSI escape sequence for gray text

func HexToRGB

func HexToRGB(hex string) (r, g, b int, err error)

HexToRGB extracts RGB values from hex color (with or without leading #)

func Italic

func Italic(text string) string

Italic returns ANSI escape sequence for italic text

func NormalizeColor

func NormalizeColor(color string) (string, error)

NormalizeColor converts a color string (hex or named) to hex format (without leading #)

func PrintColoredTag

func PrintColoredTag(tag, hex string)

PrintColoredTag prints a tag with colored indicator

func ShouldUseColors

func ShouldUseColors() bool

ShouldUseColors returns true if colored output should be used

func TerminalColorBlock

func TerminalColorBlock(hex string) string

TerminalColorBlock returns ANSI escape sequence for terminal color visualization

Types

This section is empty.

Jump to

Keyboard shortcuts

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