colors

package module
v0.0.0-...-5fa2ae2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 3 Imported by: 0

README

colors

Minimalistic terminal colors for Go that work together - inner color doesn't reset surrounding ones.

Example output

Usage

text := colors.New(colors.Codes["red"], colors.Codes["bold"]).Format("Red and Bold")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Codes = map[string]ColorCode{
	"reset": {0, 0},

	"bold":          {1, 22},
	"dim":           {2, 22},
	"italic":        {3, 23},
	"underline":     {4, 24},
	"inverse":       {7, 27},
	"hidden":        {8, 28},
	"strikethrough": {9, 29},

	"black":   {30, 39},
	"red":     {31, 39},
	"green":   {32, 39},
	"yellow":  {33, 39},
	"blue":    {34, 39},
	"magenta": {35, 39},
	"cyan":    {36, 39},
	"white":   {37, 39},
	"gray":    {90, 39},
	"grey":    {90, 39},

	"brightRed":     {91, 39},
	"brightGreen":   {92, 39},
	"brightYellow":  {93, 39},
	"brightBlue":    {94, 39},
	"brightMagenta": {95, 39},
	"brightCyan":    {96, 39},
	"brightWhite":   {97, 39},

	"bgBlack":   {40, 49},
	"bgRed":     {41, 49},
	"bgGreen":   {42, 49},
	"bgYellow":  {43, 49},
	"bgBlue":    {44, 49},
	"bgMagenta": {45, 49},
	"bgCyan":    {46, 49},
	"bgWhite":   {47, 49},
	"bgGray":    {100, 49},
	"bgGrey":    {100, 49},

	"bgBrightRed":     {101, 49},
	"bgBrightGreen":   {102, 49},
	"bgBrightYellow":  {103, 49},
	"bgBrightBlue":    {104, 49},
	"bgBrightMagenta": {105, 49},
	"bgBrightCyan":    {106, 49},
	"bgBrightWhite":   {107, 49},
}

Functions

This section is empty.

Types

type Color

type Color struct {
	// contains filtered or unexported fields
}

func New

func New(value ...ColorCode) *Color

func (*Color) Format

func (c *Color) Format(value string) string

type ColorCode

type ColorCode struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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