colors

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LEFT_ARROW is the unicode string for a left arrow glyph
	LEFT_ARROW = "\u21fe"

	// BULLET_POINT is the unicode string for a triangular bullet point
	BULLET_POINT = "\u2023"
)

This enum is to identify special unicode characters that will be used for pretty console output

Variables

This section is empty.

Functions

func Black

func Black(s any) string

Black is a ColorFunc that returns a black-colorized string of the provided input

func BlackBold

func BlackBold(s any) string

BlackBold is a ColorFunc that returns a black-bold-colorized string of the provided input

func Blue

func Blue(s any) string

Blue is a ColorFunc that returns a blue-colorized string of the provided input

func BlueBold

func BlueBold(s any) string

BlueBold is a ColorFunc that returns a blue-bold-colorized string of the provided input

func Bold

func Bold(s any) string

Bold is a ColorFunc that returns a bolded string of the provided input

func Colorize

func Colorize(s any, c Color) string

Colorize returns the string s wrapped in ANSI code c for non-windows systems Source: https://github.com/rs/zerolog/blob/4fff5db29c3403bc26dee9895e12a108aacc0203/console.go

func Cyan

func Cyan(s any) string

Cyan is a ColorFunc that returns a cyan-colorized string of the provided input

func CyanBold

func CyanBold(s any) string

CyanBold is a ColorFunc that returns a cyan-bold-colorized string of the provided input

func DarkGray

func DarkGray(s any) string

DarkGray is a ColorFunc that returns a dark-gray-colorized string of the provided input

func DarkGrayBold

func DarkGrayBold(s any) string

DarkGrayBold is a ColorFunc that returns a dark-gray-bold-colorized string of the provided input

func DisableColor added in v0.1.3

func DisableColor()

DisableColor disables the use of colors for non-windows systems.

func EnableColor

func EnableColor()

EnableColor enables the use of colors for non-windows systems.

func Green

func Green(s any) string

Green is a ColorFunc that returns a green-colorized string of the provided input

func GreenBold

func GreenBold(s any) string

GreenBold is a ColorFunc that returns a green-bold-colorized string of the provided input

func Magenta

func Magenta(s any) string

Magenta is a ColorFunc that returns a magenta-colorized string of the provided input

func MagentaBold

func MagentaBold(s any) string

MagentaBold is a ColorFunc that returns a magenta-bold-colorized string of the provided input

func Red

func Red(s any) string

Red is a ColorFunc that returns a red-colorized string of the provided input

func RedBold

func RedBold(s any) string

RedBold is a ColorFunc that returns a red-bold-colorized string of the provided input

func Reset

func Reset(s any) string

Reset is a ColorFunc that simply returns the input as a string. It is basically a no-op and is used for resetting the color context during complex logging operations.

func White

func White(s any) string

White is a ColorFunc that returns a white-colorized string of the provided input

func WhiteBold

func WhiteBold(s any) string

WhiteBold is a ColorFunc that returns a white-bold-colorized string of the provided input

func Yellow

func Yellow(s any) string

Yellow is a ColorFunc that returns a yellow-colorized string of the provided input

func YellowBold

func YellowBold(s any) string

YellowBold is a ColorFunc that returns a yellow-bold-colorized string of the provided input

Types

type Color

type Color int
const (
	// BLACK is the ANSI code for black
	BLACK Color = iota + 30
	// COLOR_RED is the ANSI code for red
	RED
	// GREEN is the ANSI code for green
	GREEN
	// YELLOW is the ANSI code for yellow
	YELLOW
	// BLUE is the ANSI code for blue
	BLUE
	// MAGENTA is the ANSI code for magenta
	MAGENTA
	// CYAN is the ANSI code for cyan
	CYAN
	// WHITE is the ANSI code for white
	WHITE
	// BOLD is the ANSI code for bold tet
	BOLD = 1
	// DARK_GRAY is the ANSI code for dark gray
	DARK_GRAY = 90
)

This is taken from zerolog's repo and will be used to colorize log output Source: https://github.com/rs/zerolog/blob/4fff5db29c3403bc26dee9895e12a108aacc0203/console.go

type ColorFunc

type ColorFunc = func(s any) string

ColorFunc is an alias type for a coloring function that accepts anything and returns a colorized string

Jump to

Keyboard shortcuts

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