tcolor

package module
v0.0.0-...-16f8bd6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2017 License: MIT Imports: 4 Imported by: 6

README

tcolor

Simple Go ANSI-colors library that supports 256 colors

Documentation

Index

Constants

View Source
const (
	Black byte = iota
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
	BrightBlack
	BrightRed
	BrightGreen
	BrightYellow
	BrightBlue
	BrightMagenta
	BrightCyan
	BrightWhite
)

Variables

View Source
var ColorOn = terminal.IsTerminal(int(os.Stdout.Fd()))

ColorOn enables colorization.

Functions

func Colorize

func Colorize(s string, color Color) string

Colorize returns the given string into the specified color. Colorize prepends the color sequence to the string and appends the reset color sequence.

Types

type Color

type Color string
const Reset Color = "0"

func New

func New() Color

func (Color) Background

func (c Color) Background(standardColor byte) Color

func (Color) BackgroundGray

func (c Color) BackgroundGray(x byte) Color

func (Color) BackgroundRGB

func (c Color) BackgroundRGB(r, g, b byte) Color

func (Color) Bold

func (c Color) Bold() Color

func (Color) Faint

func (c Color) Faint() Color

func (Color) Foreground

func (c Color) Foreground(standardColor byte) Color

func (Color) ForegroundGray

func (c Color) ForegroundGray(x byte) Color

func (Color) ForegroundRGB

func (c Color) ForegroundRGB(r, g, b byte) Color

func (Color) Italic

func (c Color) Italic() Color

func (Color) Negative

func (c Color) Negative() Color

func (Color) String

func (c Color) String() string

func (Color) Underline

func (c Color) Underline() Color

Jump to

Keyboard shortcuts

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