color

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package color is used to prettify console output via ANSII terminal colors.

Index

Constants

View Source
const (
	Gray      Color = escape + "[30m"
	Red       Color = escape + "[31m"
	Green     Color = escape + "[32m"
	Orange    Color = escape + "[33m"
	Blue      Color = escape + "[34m"
	Magenta   Color = escape + "[35m"
	Yellow    Color = escape + "[36m"
	LightGray Color = escape + "[37m"

	BgGray      Color = escape + "[40m"
	BgRed       Color = escape + "[41m"
	BgGreen     Color = escape + "[42m"
	BgOrange    Color = escape + "[43m"
	BgBlue      Color = escape + "[44m"
	BgMagenta   Color = escape + "[45m"
	BgYellow    Color = escape + "[46m"
	BgLightGray Color = escape + "[47m"

	Bold         Attribute = escape + "[1m"
	Italic       Attribute = escape + "[3m"
	Underline    Attribute = escape + "[4m"
	ReverseColor Attribute = escape + "[7m"

	Test     Color     = BgYellow
	TestAttr Attribute = Bold
)

The possible color variations.

Variables

View Source
var Colored bool

Colored DTail client output enabled.

Functions

func Attr

func Attr(c Attribute, s string) string

Attr adds a given attribute to a given string, such as "bold" or "italic".

func Colorfy

func Colorfy(line string) string

Colorfy a given line based on the line's content.

func Paint

func Paint(c Color, s string) string

Paint a given string in a given color.

Types

type Attribute

type Attribute string

Attribute of a color.

type Color

type Color string

Color name.

Jump to

Keyboard shortcuts

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