README

Colors

A small golang utility to print colorful output on terminal

Installation

go get -u github.com/amulyakashyap09/colors

import color "github.com/amulyakashyap09/colors"

Usage

var message string = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."

#bgColor, fgColor, message
color.Custom("black", "yellow", message)

Documentation

color.Custom(bgColor, fgColor, message) | color.Custom will print the message in colors provided as input

color.Error(message) | color.Error will print the error in red & bold

color.Panic(message) | color.Panic will print the error in red & bold & will exit the process

color.Success(message) | color.Success will print the message in green

color.Info(message) | color.Info will print the message in blue

color.Warn(message) | color.Warn will print the message in yellow

color.Yellow(message) | color.Yellow will print the message in yellow

color.Blue(message) | color.Blue will print the message in blue

color.Green(message) | color.Green will print the message in green

color.Red(message) | color.Red will print the message in red

color.Magenta(message) | color.Magenta will print the message in magenta

color.Cyan(message) | color.Cyan will print the message in cyan

color.White(message) | color.White will print the message in white

color.Black(message) | color.Black will print the message in black

Author

Amulya Kashyap
amulyakasyap09@gmail.com
Expand ▾ Collapse ▴

Documentation

Index

Constants

View Source
const (
	Reset      = "\x1b[0m"
	Bright     = "\x1b[1m"
	Dim        = "\x1b[2m"
	Underscore = "\x1b[4m"
	Blink      = "\x1b[5m"
	Reverse    = "\x1b[7m"
	Hidden     = "\x1b[8m"

	FgBlack   = "\x1b[30m"
	FgRed     = "\x1b[31m"
	FgGreen   = "\x1b[32m"
	FgYellow  = "\x1b[33m"
	FgBlue    = "\x1b[34m"
	FgMagenta = "\x1b[35m"
	FgCyan    = "\x1b[36m"
	FgWhite   = "\x1b[37m"

	BgBlack   = "\x1b[40m"
	BgRed     = "\x1b[41m"
	BgGreen   = "\x1b[42m"
	BgYellow  = "\x1b[43m"
	BgBlue    = "\x1b[44m"
	BgMagenta = "\x1b[45m"
	BgCyan    = "\x1b[46m"
	BgWhite   = "\x1b[47m"
)

Variables

This section is empty.

Functions

func Black

func Black(message ...Message)

func Blue

func Blue(message ...Message)

func Bold

func Bold(message ...Message)

func Custom

func Custom(fgColor string, bgColor string, message ...Message)

func Cyan

func Cyan(message ...Message)

func Error

func Error(message ...Message)

func Flash

func Flash(message ...Message)

func Green

func Green(message ...Message)

func Highlight

func Highlight(message ...Message)

func Important

func Important(message ...Message)

func Info

func Info(message ...Message)

func Inverse

func Inverse(message ...Message)

func Magenta

func Magenta(message ...Message)

func Panic

func Panic(message ...Message)

func Red

func Red(message ...Message)

func Success

func Success(message ...Message)

func Underline

func Underline(message ...Message)

func Warn

func Warn(message ...Message)

func White

func White(message ...Message)

func Yellow

func Yellow(message ...Message)

Types

type Message

type Message interface{}