colors

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANSIReset      = "\x1b[0m"
	ANSIBright     = "\x1b[1m"
	ANSIDim        = "\x1b[2m"
	ANSIUnderscore = "\x1b[4m"
	ANSIBlink      = "\x1b[5m"
	ANSIReverse    = "\x1b[7m"
	ANSIHidden     = "\x1b[8m"

	ANSIFgBlack   = "\x1b[30m"
	ANSIFgRed     = "\x1b[31m"
	ANSIFgGreen   = "\x1b[32m"
	ANSIFgYellow  = "\x1b[33m"
	ANSIFgBlue    = "\x1b[34m"
	ANSIFgMagenta = "\x1b[35m"
	ANSIFgCyan    = "\x1b[36m"
	ANSIFgWhite   = "\x1b[37m"

	ANSIFgGray = "\x1b[90m" // bright black

	ANSIBgBlack   = "\x1b[40m"
	ANSIBgRed     = "\x1b[41m"
	ANSIBgGreen   = "\x1b[42m"
	ANSIBgYellow  = "\x1b[43m"
	ANSIBgBlue    = "\x1b[44m"
	ANSIBgMagenta = "\x1b[45m"
	ANSIBgCyan    = "\x1b[46m"
	ANSIBgWhite   = "\x1b[47m"
)

Variables

This section is empty.

Functions

func Black

func Black(args ...any) string

func Blue

func Blue(args ...any) string

func ColoredBytes

func ColoredBytes(data []byte, textColor, bytesColor func(...any) string) string

func ColoredBytesN

func ColoredBytesN(data []byte, n int, textColor, bytesColor func(...any) string) string

result may be 4 ASNSII chars longer than they should be to denote the elipses (...), and one for a trailing hex nibble in case the last byte is non-ascii. NOTE: it is annoying to try make this perfect and always fit within n, so we don't do this yet, but left as an exercise. :)

func Cyan

func Cyan(args ...any) string

func DefaultColoredBytes

func DefaultColoredBytes(data []byte) string

func DefaultColoredBytesN

func DefaultColoredBytesN(data []byte, n int) string

func Gray

func Gray(args ...any) string

func Green

func Green(args ...any) string

func Magenta

func Magenta(args ...any) string

func None

func None(args ...any) string

func Red

func Red(args ...any) string

func White

func White(args ...any) string

func Yellow

func Yellow(args ...any) string

Types

type Color

type Color func(args ...any) string

Jump to

Keyboard shortcuts

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