package
0.4.2
Repository: https://github.com/labstack/gommon.git
Documentation: pkg.go.dev

# README

Color

Style terminal text.

Installation

go get github.com/labstack/gommon/color

Windows?

Try cmder or https://github.com/mattn/go-colorable

Usage

import github.com/labstack/gommon/color

Colored text

color.Println(color.Black("black"))
color.Println(color.Red("red"))
color.Println(color.Green("green"))
color.Println(color.Yellow("yellow"))
color.Println(color.Blue("blue"))
color.Println(color.Magenta("magenta"))
color.Println(color.Cyan("cyan"))
color.Println(color.White("white"))
color.Println(color.Grey("grey"))

Colored Text

Colored background

color.Println(color.BlackBg("black background", color.Wht))
color.Println(color.RedBg("red background"))
color.Println(color.GreenBg("green background"))
color.Println(color.YellowBg("yellow background"))
color.Println(color.BlueBg("blue background"))
color.Println(color.MagentaBg("magenta background"))
color.Println(color.CyanBg("cyan background"))
color.Println(color.WhiteBg("white background"))

Colored Background

Emphasis

color.Println(color.Bold("bold"))
color.Println(color.Dim("dim"))
color.Println(color.Italic("italic"))
color.Println(color.Underline("underline"))
color.Println(color.Inverse("inverse"))
color.Println(color.Hidden("hidden"))
color.Println(color.Strikeout("strikeout"))

Emphasis

Mix and match

color.Println(color.Green("bold green with white background", color.B, color.WhtBg))
color.Println(color.Red("underline red", color.U))
color.Println(color.Yellow("dim yellow", color.D))
color.Println(color.Cyan("inverse cyan", color.In))
color.Println(color.Blue("bold underline dim blue", color.B, color.U, color.D))

Mix and match

Enable/Disable the package

color.Disable()
color.Enable()

New instance

c := New()
c.Green("green")

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
New creates a Color instance.
Output returns the output.
Print is analogous to `fmt.Print` with termial detection.
Printf is analogous to `fmt.Printf` with termial detection.
Println is analogous to `fmt.Println` with termial detection.
No description provided by the author
No description provided by the author
No description provided by the author
SetOutput sets the output.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

B bold emphasis style.
Blk Black text style.
BlkBg black background style.
Blu blue text style.
BluBg blue background style.
Cyn cyan text style.
CynBg cyan background style.
D dim emphasis style.
Grn green text style.
GrnBg green background style.
Gry grey text style.
H hidden emphasis style.
I italic emphasis style.
In inverse emphasis style.
Mgn magenta text style.
MgnBg magenta background style.
R reset emphasis style.
Rd red text style.
RdBg red background style.
S strikeout emphasis style.
U underline emphasis style.
Wht white text style.
WhtBg white background style.
Yel yellow text style.
YelBg yellow background style.

# Structs

No description provided by the author