color

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Colorizer

type Colorizer interface {
	// Write prints s to w using the current color scheme. If w is not a terminal or if it is redirected, no color codes are printed
	Write(w io.Writer, s string, scheme string, t TextType) error
	// Styles returns the array of available style names
	Styles() []string
}

Colorizer has methods to write colorized text to a stream

func New

func New(forceColor bool) Colorizer

type TextType

type TextType int

TextType defines a category of text that can be colorized

const (
	// TextTypeNormal is non-categorized text that prints with the default color
	TextTypeNormal TextType = iota
	// TextTypeTSql is for transact-sql syntax
	TextTypeTSql
	// TextTypeHeader is for a table column header or cell label
	TextTypeHeader
	// TextTypeCell is for a cell value
	TextTypeCell
	// TextTypeSeparator is for characters that delimit columns and rows
	TextTypeSeparator
	// TextTypeError is for error messages
	TextTypeError
	// TextTypeWarning is for warning messages
	TextTypeWarning
	// TextTypeXml indicates the content is XML
	TextTypeXml
)

Jump to

Keyboard shortcuts

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