Documentation ¶
Index ¶
- Constants
- func Blue(a interface{}, w ...interface{}) string
- func ColorWithName(color string, a interface{}, w ...interface{}) string
- func Colorize(color string, v interface{}, w ...interface{}) string
- func CornSilk(a interface{}, w ...interface{}) string
- func Cyan(a interface{}, w ...interface{}) string
- func DarkMagenta(a interface{}, w ...interface{}) string
- func DarkOrange(a interface{}, w ...interface{}) string
- func DeepPink(a interface{}, w ...interface{}) string
- func Default(a interface{}, w ...interface{}) string
- func DefaultBackgroundColor() string
- func DefaultFlags() string
- func DefaultForegroundColor() string
- func DefaultWidth() int
- func FloatPrecision() int
- func GoldenRod(a interface{}, w ...interface{}) string
- func Green(a interface{}, w ...interface{}) string
- func Lavender(a interface{}, w ...interface{}) string
- func LightBlue(a interface{}, w ...interface{}) string
- func LightCoral(a interface{}, w ...interface{}) string
- func LightCyan(a interface{}, w ...interface{}) string
- func LightGreen(a interface{}, w ...interface{}) string
- func LightSalmon(a interface{}, w ...interface{}) string
- func LightSkyBlue(a interface{}, w ...interface{}) string
- func LightYellow(a interface{}, w ...interface{}) string
- func MediumBlue(a interface{}, w ...interface{}) string
- func MediumSpringGreen(a interface{}, w ...interface{}) string
- func MistyRose(a interface{}, w ...interface{}) string
- func Orange(a interface{}, w ...interface{}) string
- func Red(a interface{}, w ...interface{}) string
- func SetDefault(foreground, background string, width, precision int, flags string)
- func SetDefaultBackgroundColor(color string)
- func SetDefaultFlags(f string)
- func SetDefaultForegroundColor(color string)
- func SetDefaultWidth(w int)
- func SetFloatPrecision(w int)
- func SkyBlue(a interface{}, w ...interface{}) string
- func Teal(a interface{}, w ...interface{}) string
- func Wheat(a interface{}, w ...interface{}) string
- func Yellow(a interface{}, w ...interface{}) string
- func YellowGreen(a interface{}, w ...interface{}) string
Constants ¶
const ( NoColor = "" DefaultColor = "white" YellowColor = "yellow" GreenColor = "green" GoldenRodColor = "goldenrod" OrangeColor = "orange" TealColor = "teal" CornSilkColor = "cornsilk" DeepPinkColor = "deeppink" RedColor = "red" BlueColor = "blue" LightBlueColor = "lightblue" LightCoralColor = "lightcoral" LightCyanColor = "lightcyan" LavenderColor = "lavender" LightSalmonColor = "lightsalmon" MediumBlueColor = "mediumblue" MistyRoseColor = "mistyrose" SkyBlueColor = "skyblue" LightSkyBlueColor = "lightskyblue" MediumSpringGreenColor = "mediumspringgreen" WheatColor = "wheat" YellowGreenColor = "yellowgreen" LightYellowColor = "lightyellow" DarkOrangeColor = "darkorange" LightGreenColor = "lightgreen" DarkMagentaColor = "darkmagenta" CyanColor = "aqua" )
Color constant names we can use
Variables ¶
This section is empty.
Functions ¶
func Blue ¶
func Blue(a interface{}, w ...interface{}) string
Blue - return string based on the color given
func ColorWithName ¶
ColorWithName - Find and set the color by name. This function takes a color name as a string, converts it to lowercase, and checks if it exists in the tcell.ColorNames map. If it does, the color is used. If it doesn't, the color is set to the default color, OrangeColor. Then, it calls the Colorize function with the determined color, the provided value, and any additional parameters.
Parameters: - color: A string representing the color name. - a: The value to be colorized. It can be of type string, integer, float, or any other type. - w: A variadic parameter that can contain optional width, precision, foreground color, background color, and flags.
Returns: - A string with the colorized value.
Usage:
colorize.ColorWithName("red", "Hello, World!", 20, 2, "yellow", "blue") colorize.ColorWithName("", 123.456, 10, 2) colorize.ColorWithName("green", "Goodbye", -10) // Left alignment
func Colorize ¶
Colorize function is used to add color to the value passed, with optional width, precision, foreground color, background color, and flags.
Parameters: - color: A string representing the color to be applied. If empty, the default foreground color will be used. - v: The value to be colorized. It can be of type string, integer, float, or any other type. - w: A variadic parameter that can contain optional width, precision, foreground color, background color, and flags.
Returns: - A string with the colorized value.
Usage:
colorize.Colorize("red", "Hello, World!", 20, 2, "yellow", "blue") colorize.Colorize("", 123.456, 10, 2) colorize.Colorize("green", "Goodbye", -10) // Left alignment
func CornSilk ¶
func CornSilk(a interface{}, w ...interface{}) string
CornSilk - return string based on the color given
func Cyan ¶
func Cyan(a interface{}, w ...interface{}) string
Cyan - return string based on the color given
func DarkMagenta ¶
func DarkMagenta(a interface{}, w ...interface{}) string
DarkMagenta - return string based on the color given
func DarkOrange ¶
func DarkOrange(a interface{}, w ...interface{}) string
DarkOrange - return string based on the color given
func DeepPink ¶
func DeepPink(a interface{}, w ...interface{}) string
DeepPink - return string based on the color given
func Default ¶
func Default(a interface{}, w ...interface{}) string
Default - The default color for the text
func DefaultBackgroundColor ¶
func DefaultBackgroundColor() string
DefaultBackgroundColor returns the default color
func DefaultForegroundColor ¶
func DefaultForegroundColor() string
DefaultForegroundColor returns the default color
func GoldenRod ¶
func GoldenRod(a interface{}, w ...interface{}) string
GoldenRod - return string based on the color given
func Green ¶
func Green(a interface{}, w ...interface{}) string
Green - return string based on the color given
func Lavender ¶
func Lavender(a interface{}, w ...interface{}) string
Lavender - return string based on the color given
func LightBlue ¶
func LightBlue(a interface{}, w ...interface{}) string
LightBlue - return string based on the color given
func LightCoral ¶
func LightCoral(a interface{}, w ...interface{}) string
LightCoral - return string based on the color given
func LightCyan ¶
func LightCyan(a interface{}, w ...interface{}) string
LightCyan - return string based on the color given
func LightGreen ¶
func LightGreen(a interface{}, w ...interface{}) string
LightGreen - return string based on the color given
func LightSalmon ¶
func LightSalmon(a interface{}, w ...interface{}) string
LightSalmon - return string based on the color given
func LightSkyBlue ¶
func LightSkyBlue(a interface{}, w ...interface{}) string
LightSkyBlue - return string based on the color given
func LightYellow ¶
func LightYellow(a interface{}, w ...interface{}) string
LightYellow - return string based on the color given
func MediumBlue ¶
func MediumBlue(a interface{}, w ...interface{}) string
MediumBlue - return string based on the color given
func MediumSpringGreen ¶
func MediumSpringGreen(a interface{}, w ...interface{}) string
MediumSpringGreen - return string based on the color given
func MistyRose ¶
func MistyRose(a interface{}, w ...interface{}) string
MistyRose - return string based on the color given
func Orange ¶
func Orange(a interface{}, w ...interface{}) string
Orange - return string based on the color given
func Red ¶
func Red(a interface{}, w ...interface{}) string
Red - return string based on the color given
func SetDefault ¶
SetDefault initializes the colorizeInfo struct with default values for color, width, precision, and flags. If precision is negative, it is set to the default value.
Parameters: - foreground: A string representing the default foreground color. - background: A string representing the default background color. - width: An integer representing the default width of the field. - precision: An integer representing the default precision for float values. - flags: A string representing the default flags for color attributes.
func SetDefaultBackgroundColor ¶
func SetDefaultBackgroundColor(color string)
SetDefaultBackgroundColor - Set the default background color
func SetDefaultForegroundColor ¶
func SetDefaultForegroundColor(color string)
SetDefaultForegroundColor - Set the default foreground color
func SkyBlue ¶
func SkyBlue(a interface{}, w ...interface{}) string
SkyBlue - return string based on the color given
func Teal ¶
func Teal(a interface{}, w ...interface{}) string
Teal - return string based on the color given
func Wheat ¶
func Wheat(a interface{}, w ...interface{}) string
Wheat - return string based on the color given
func Yellow ¶
func Yellow(a interface{}, w ...interface{}) string
Yellow - return string based on the color given
func YellowGreen ¶
func YellowGreen(a interface{}, w ...interface{}) string
YellowGreen - return string based on the color given
Types ¶
This section is empty.