Documentation ¶
Overview ¶
Package ansi contains helpers for working with ansi colors.
These colors are used by the terminal.
Index ¶
- Constants
- func Apply(colorCode Color, text string) string
- func Black(text string) string
- func Blue(text string) string
- func Bold(colorCode Color, text string) string
- func Cyan(text string) string
- func Green(text string) string
- func LightBlack(text string) string
- func LightBlue(text string) string
- func LightCyan(text string) string
- func LightGreen(text string) string
- func LightPurple(text string) string
- func LightRed(text string) string
- func LightWhite(text string) string
- func LightYellow(text string) string
- func Purple(text string) string
- func Red(text string) string
- func Table(wr io.Writer, columns []string, rows [][]string) (err error)
- func TableForSlice(wr io.Writer, collection interface{}) error
- func Underline(colorCode Color, text string) string
- func White(text string) string
- func Yellow(text string) string
- type Color
Constants ¶
View Source
const ( TableTopLeft = "┌" TableTopRight = "┐" TableBottomLeft = "└" TableBottomRight = "┘" TableMidLeft = "├" TableMidRight = "┤" TableVertBar = "│" TableHorizBar = "─" TableTopSep = "┬" TableBottomSep = "┴" TableMidSep = "┼" NewLine = "\n" )
Table character constants.
View Source
const (
ColorReset = "\033[0m"
)
Utility Color Codes
Variables ¶
This section is empty.
Functions ¶
func TableForSlice ¶
TableForSlice prints a table for a given slice. It will infer column names from the struct fields. If it is a mixed array (i.e. []interface{}) it will probably panic.
Types ¶
type Color ¶
type Color string
Color represents an ansi color code fragment.
const ( ColorBlack Color = "30m" ColorRed Color = "31m" ColorGreen Color = "32m" ColorYellow Color = "33m" ColorBlue Color = "34m" ColorPurple Color = "35m" ColorCyan Color = "36m" ColorWhite Color = "37m" )
Color codes
const ( ColorLightBlack Color = "90m" ColorLightRed Color = "91m" ColorLightGreen Color = "92m" ColorLightYellow Color = "93m" ColorLightBlue Color = "94m" ColorLightPurple Color = "95m" ColorLightCyan Color = "96m" ColorLightWhite Color = "97m" )
BrightColorCodes
const ( ColorBackgroundBlack Color = "40m" ColorBackgroundRed Color = "41m" ColorBackgroundGreen Color = "42m" ColorBackgroundYellow Color = "43m" ColorBackgroundBlue Color = "44m" ColorBackgroundPurple Color = "45m" ColorBackgroundCyan Color = "46m" ColorBackgroundWhite Color = "47m" )
BackgroundColorCodes
const ( ColorBackgroundBrightBlack Color = "100m" ColorBackgroundBrightRed Color = "101m" ColorBackgroundBrightGreen Color = "102m" ColorBackgroundBrightYellow Color = "103m" ColorBackgroundBrightBlue Color = "104m" ColorBackgroundBrightPurple Color = "105m" ColorBackgroundBrightCyan Color = "106m" ColorBackgroundBrightWhite Color = "107m" )
BackgroundColorCodes
Click to show internal directories.
Click to hide internal directories.