ansi

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 2 Imported by: 7

Documentation

Overview

Package ansi can print colored and styled text to your terminal.

Index

Constants

View Source
const (
	Black = Col(iota)
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

defines supported colors

View Source
const (
	TReset = Col(iota)
	TBold
	TFaint
	TItalic
	TUnderline
	TBlinkSlow
	TBlinkFast
	TNegative
	TConceal
	TCrossedOut
)

defines text styling options

View Source
const (
	FgBlack = Col(iota + 30)
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Foreground text colors

View Source
const (
	BgBlack = Col(iota + 40)
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

Background text colors

Variables

This section is empty.

Functions

func BgColor

func BgColor(str interface{}, col Col) string

BgColor adds the color code of col as background color to str and returns as string

func Bold

func Bold(str interface{}) string

Bold surrounds str with the code for bold styled text

func Color

func Color(str interface{}, col Col) string

Color adds the color code of col as text color to str and returns as string

func Log

func Log(valuea ...interface{}) interface{}

Log prints red text via log package

func Set

func Set(str interface{}, Attribute ...Col) string

Set sets styling options on strings and stringable interfaces

func Underline

func Underline(str interface{}) string

Underline surrounds str with the code for underlined text

Types

type Col

type Col int

Col defines supported colors

Jump to

Keyboard shortcuts

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