Documentation ¶
Index ¶
- Constants
- func Clear()
- func Grayscale(brightness int) int
- func MoveCursor(x int, y int)
- func Print(str string, colorFg color.Color, colorBg color.Color)
- func Print256(str string, colorFg int, colorBg int)
- func PrintBg(str string, color color.Color)
- func PrintBg256(str string, color int)
- func PrintBold(str string)
- func PrintFg(str string, color color.Color)
- func PrintFg256(str string, color int)
- func PrintUnderline(str string)
- func Println(str string, colorFg color.Color, colorBg color.Color)
- func Println256(str string, colorFg int, colorBg int)
- func PrintlnBg(str string, color color.Color)
- func PrintlnBg256(str string, color int)
- func PrintlnBold(str string)
- func PrintlnFg(str string, color color.Color)
- func PrintlnFg256(str string, color int)
- func PrintlnUnderline(str string)
- func Reset()
- func ResetBold()
- func ResetCursor()
- func ResetUnderline()
- func SetBackgroundColor(color color.Color)
- func SetBackgroundColor256(color int)
- func SetBold()
- func SetForegroundColor(color color.Color)
- func SetForegroundColor256(color int)
- func SetUnderline()
- func Sprint(str string, colorFg color.Color, colorBg color.Color) string
- func SprintBg(str string, color color.Color) string
- func SprintBold(str string) string
- func SprintFg(str string, color color.Color) string
- func SprintUnderline(str string) string
Constants ¶
const ( Black = 0 DarkRed = 1 DarkGreen = 2 DarkYellow = 3 DarkBlue = 4 DarkMagenta = 5 DarkTurquoise = 6 Gray = 7 DarkGray = 8 LightRed = 9 LightGreen = 10 LightYellow = 11 LightBlue = 12 LightMagenta = 13 LightTurquoise = 14 White = 15 )
Variables ¶
This section is empty.
Functions ¶
func MoveCursor ¶
func Print ¶
Print formats the given string with ANSI color codes and outputs it to the console
Param str: string to be formatted
Param colorFg: foreground color of the text
Param colorBg: background color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func Print256 ¶
Print256 formats the given string with ANSI color codes and outputs it to the console
Param str: string to be formatted
Param colorFg: foreground color of the text, ranging from 0 to 255 (extended ANSI palette)
Param colorBg: background color of the text, ranging from 0 to 255 (extended ANSI palette)
func PrintBg ¶
PrintBg formats the given string with ANSI background color code and outputs it to the console
Param str: string to be formatted
Param color: background color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func PrintBg256 ¶
PrintBg256 formats the given string with ANSI color codes and outputs it to the console
Param str: string to be formatted
Param color: background color of the text, ranging from 0 to 255 (extended ANSI palette)
func PrintBold ¶
func PrintBold(str string)
PrintBold formats the given string with ANSI bold code and outputs it to the console
Param str: string to be formatted
func PrintFg ¶
PrintFg formats the given string with ANSI foreground color code and outputs it to the console
Param str: string to be formatted
Param color: foreground color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func PrintFg256 ¶
PrintFg256 formats the given string with ANSI color codes and outputs it to the console
Param str: string to be formatted
Param color: foreground color of the text, ranging from 0 to 255 (extended ANSI palette)
func PrintUnderline ¶
func PrintUnderline(str string)
PrintUnderline formats the given string with ANSI underline code and outputs it to the console
Param str: string to be formatted
func Println ¶
Println formats the given string with ANSI color codes and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
Param colorFg: foreground color of the text
Param colorBg: background color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func Println256 ¶
Println256 formats the given string with ANSI color codes and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
Param colorFg: foreground color of the text, ranging from 0 to 255 (extended ANSI palette)
Param colorBg: background color of the text, ranging from 0 to 255 (extended ANSI palette)
func PrintlnBg ¶
PrintlnBg formats the given string with ANSI background color code and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
Param color: background color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func PrintlnBg256 ¶
PrintlnBg256 formats the given string with ANSI color codes and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
Param color: background color of the text, ranging from 0 to 255 (extended ANSI palette)
func PrintlnBold ¶
func PrintlnBold(str string)
PrintlnBold formats the given string with ANSI bold code and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
func PrintlnFg ¶
PrintlnFg formats the given string with ANSI foreground color code and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
Param color: foreground color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func PrintlnFg256 ¶
PrintlnFg256 formats the given string with ANSI color codes and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
Param color: foreground color of the text, ranging from 0 to 255 (extended ANSI palette)
func PrintlnUnderline ¶
func PrintlnUnderline(str string)
PrintlnUnderline formats the given string with ANSI underline code and outputs it to the console, appending it with the "\n" character
Param str: string to be formatted
func ResetCursor ¶
func ResetCursor()
func SetBackgroundColor ¶
SetBackgroundColor sets the background color of the console output to given color until the next Reset call
Param color: background color to be set
func SetBackgroundColor256 ¶
func SetBackgroundColor256(color int)
SetBackgroundColor256 sets the background color of console output until the next Reset call
Param color: background color to be set, ranging from 0 to 255 (extended ANSI palette)
func SetBold ¶
func SetBold()
SetBold sets the console output to be in bold style until the next ResetBold or Reset call
func SetForegroundColor ¶
SetForegroundColor sets the foreground color of the console output to given color until the next Reset call
Param color: foreground color to be set
func SetForegroundColor256 ¶
func SetForegroundColor256(color int)
SetForegroundColor256 sets the foreground color of console output until the next Reset call
Param color: foreground color to be set, ranging from 0 to 255 (extended ANSI palette)
func SetUnderline ¶
func SetUnderline()
SetUnderline sets the console output to be in underline style until the next ResetUnderline or Reset call
func Sprint ¶
Sprint formats the given string with ANSI color codes and returns it
Param str: string to be formatted
Param colorFg: foreground color of the text
Param colorBg: background color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func SprintBg ¶
SprintBg formats the given string with ANSI background color code and returns it
Param str: string to be formatted
Param color: background color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func SprintBold ¶
SprintBold formats the given string with ANSI bold code and returns it
Param str: string to be formatted
func SprintFg ¶
SprintFg formats the given string with ANSI foreground color code and returns it
Param str: string to be formatted
Param color: foreground color of the text
Note: Even if your console does not support RGB color codes, it will still select the closest color from its palette
func SprintUnderline ¶
SprintUnderline formats the given string with ANSI underline code and returns it
Param str: string to be formatted
Types ¶
This section is empty.