Documentation
¶
Index ¶
- Variables
- func All(color string, strs ...any) string
- func Autof(format string, a ...any) string
- func Colorize(color string, s any) string
- func InBlack(s any) string
- func InBlackOverBlack(s any) string
- func InBlackOverBlue(s any) string
- func InBlackOverCyan(s any) string
- func InBlackOverGray(s any) string
- func InBlackOverGreen(s any) string
- func InBlackOverPurple(s any) string
- func InBlackOverRed(s any) string
- func InBlackOverWhite(s any) string
- func InBlackOverYellow(s any) string
- func InBlue(s any) string
- func InBlueOverBlack(s any) string
- func InBlueOverBlue(s any) string
- func InBlueOverCyan(s any) string
- func InBlueOverGray(s any) string
- func InBlueOverGreen(s any) string
- func InBlueOverPurple(s any) string
- func InBlueOverRed(s any) string
- func InBlueOverWhite(s any) string
- func InBlueOverYellow(s any) string
- func InBold(s any) string
- func InCyan(s any) string
- func InCyanOverBlack(s any) string
- func InCyanOverBlue(s any) string
- func InCyanOverCyan(s any) string
- func InCyanOverGray(s any) string
- func InCyanOverGreen(s any) string
- func InCyanOverPurple(s any) string
- func InCyanOverRed(s any) string
- func InCyanOverWhite(s any) string
- func InCyanOverYellow(s any) string
- func InGray(s any) string
- func InGrayOverBlack(s any) string
- func InGrayOverBlue(s any) string
- func InGrayOverCyan(s any) string
- func InGrayOverGray(s any) string
- func InGrayOverGreen(s any) string
- func InGrayOverPurple(s any) string
- func InGrayOverRed(s any) string
- func InGrayOverWhite(s any) string
- func InGrayOverYellow(s any) string
- func InGreen(s any) string
- func InGreenOverBlack(s any) string
- func InGreenOverBlue(s any) string
- func InGreenOverCyan(s any) string
- func InGreenOverGray(s any) string
- func InGreenOverGreen(s any) string
- func InGreenOverPurple(s any) string
- func InGreenOverRed(s any) string
- func InGreenOverWhite(s any) string
- func InGreenOverYellow(s any) string
- func InPurple(s any) string
- func InPurpleOverBlack(s any) string
- func InPurpleOverBlue(s any) string
- func InPurpleOverCyan(s any) string
- func InPurpleOverGray(s any) string
- func InPurpleOverGreen(s any) string
- func InPurpleOverPurple(s any) string
- func InPurpleOverRed(s any) string
- func InPurpleOverWhite(s any) string
- func InPurpleOverYellow(s any) string
- func InRed(s any) string
- func InRedOverBlack(s any) string
- func InRedOverBlue(s any) string
- func InRedOverCyan(s any) string
- func InRedOverGray(s any) string
- func InRedOverGreen(s any) string
- func InRedOverPurple(s any) string
- func InRedOverRed(s any) string
- func InRedOverWhite(s any) string
- func InRedOverYellow(s any) string
- func InUnderline(s any) string
- func InWhite(s any) string
- func InWhiteOverBlack(s any) string
- func InWhiteOverBlue(s any) string
- func InWhiteOverCyan(s any) string
- func InWhiteOverGray(s any) string
- func InWhiteOverGreen(s any) string
- func InWhiteOverPurple(s any) string
- func InWhiteOverRed(s any) string
- func InWhiteOverWhite(s any) string
- func InWhiteOverYellow(s any) string
- func InYellow(s any) string
- func InYellowOverBlack(s any) string
- func InYellowOverBlue(s any) string
- func InYellowOverCyan(s any) string
- func InYellowOverGray(s any) string
- func InYellowOverGreen(s any) string
- func InYellowOverPurple(s any) string
- func InYellowOverRed(s any) string
- func InYellowOverWhite(s any) string
- func InYellowOverYellow(s any) string
- func Ize(color string, s any) string
- func OverBlack(s any) string
- func OverBlue(s any) string
- func OverCyan(s any) string
- func OverGray(s any) string
- func OverGreen(s any) string
- func OverPurple(s any) string
- func OverRed(s any) string
- func OverWhite(s any) string
- func OverYellow(s any) string
- func Toggle(enable bool)
- func With(color string, s any) string
Constants ¶
This section is empty.
Variables ¶
var ( Reset = "\033[0m" Bold = "\033[1m" Underline = "\033[4m" Black = "\033[30m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Purple = "\033[35m" Cyan = "\033[36m" Gray = "\033[37m" White = "\033[97m" BlackBackground = "\033[40m" RedBackground = "\033[41m" GreenBackground = "\033[42m" YellowBackground = "\033[43m" BlueBackground = "\033[44m" PurpleBackground = "\033[45m" CyanBackground = "\033[46m" GrayBackground = "\033[47m" WhiteBackground = "\033[107m" )
Functions ¶
func All ¶
All wraps a given messages in a given color.
Example:
println(color.All(color.Red, "This is ", "red"))
func Autof ¶
Autof automatically colors the arguments given for a specific format. Works exactly like fmt.Sprintf.
WARNING: THIS IS AN EXPERIMENTAL FEATURE AND IT MAY BE REMOVED BASED ON USER FEEDBACK. IF YOU USE THIS FEATURE, PLEASE PROVIDE FEEDBACK ON https://github.com/TwiN/go-color/discussions/13
Example:
println(Autof("Hello, %s.", "world"))
func Colorize ¶
Colorize wraps a given message in a given color.
Example:
println(color.Colorize(color.Red, "This is red"))
func InBlack ¶
InBlack wraps the given string s in Black
Example:
println(color.InBlack("This is black"))
func InBlackOverBlack ¶
func InBlackOverBlue ¶
func InBlackOverCyan ¶
func InBlackOverGray ¶
func InBlackOverGreen ¶
func InBlackOverPurple ¶
func InBlackOverRed ¶
func InBlackOverWhite ¶
func InBlackOverYellow ¶
func InBlue ¶
InBlue wraps the given string s in Blue
Example:
println(color.InBlue("This is blue"))
func InBlueOverBlack ¶
func InBlueOverBlue ¶
func InBlueOverCyan ¶
func InBlueOverGray ¶
func InBlueOverGreen ¶
func InBlueOverPurple ¶
func InBlueOverRed ¶
func InBlueOverWhite ¶
func InBlueOverYellow ¶
func InBold ¶
InBold wraps the given string s in Bold
Example:
println(color.InBold("This is bold"))
func InCyan ¶
InCyan wraps the given string s in Cyan
Example:
println(color.InCyan("This is cyan"))
func InCyanOverBlack ¶
func InCyanOverBlue ¶
func InCyanOverCyan ¶
func InCyanOverGray ¶
func InCyanOverGreen ¶
func InCyanOverPurple ¶
func InCyanOverRed ¶
func InCyanOverWhite ¶
func InCyanOverYellow ¶
func InGray ¶
InGray wraps the given string s in Gray
Example:
println(color.InGray("This is gray"))
func InGrayOverBlack ¶
func InGrayOverBlue ¶
func InGrayOverCyan ¶
func InGrayOverGray ¶
func InGrayOverGreen ¶
func InGrayOverPurple ¶
func InGrayOverRed ¶
func InGrayOverWhite ¶
func InGrayOverYellow ¶
func InGreen ¶
InGreen wraps the given string s in Green
Example:
println(color.InGreen("This is green"))
func InGreenOverBlack ¶
func InGreenOverBlue ¶
func InGreenOverCyan ¶
func InGreenOverGray ¶
func InGreenOverGreen ¶
func InGreenOverPurple ¶
func InGreenOverRed ¶
func InGreenOverWhite ¶
func InGreenOverYellow ¶
func InPurple ¶
InPurple wraps the given string s in Purple
Example:
println(color.InPurple("This is purple"))
func InPurpleOverBlack ¶
func InPurpleOverBlue ¶
func InPurpleOverCyan ¶
func InPurpleOverGray ¶
func InPurpleOverGreen ¶
func InPurpleOverPurple ¶
func InPurpleOverRed ¶
func InPurpleOverWhite ¶
func InPurpleOverYellow ¶
func InRedOverBlack ¶
func InRedOverBlue ¶
func InRedOverCyan ¶
func InRedOverGray ¶
func InRedOverGreen ¶
func InRedOverPurple ¶
func InRedOverRed ¶
func InRedOverWhite ¶
func InRedOverYellow ¶
func InUnderline ¶
InUnderline wraps the given string s in Underline
Example:
println(color.InUnderline("This is underlined"))
func InWhite ¶
InWhite wraps the given string s in White
Example:
println(color.InWhite("This is white"))
func InWhiteOverBlack ¶
func InWhiteOverBlue ¶
func InWhiteOverCyan ¶
func InWhiteOverGray ¶
func InWhiteOverGreen ¶
func InWhiteOverPurple ¶
func InWhiteOverRed ¶
func InWhiteOverWhite ¶
func InWhiteOverYellow ¶
func InYellow ¶
InYellow wraps the given string s in Yellow
Example:
println(color.InYellow("This is yellow"))
func InYellowOverBlack ¶
func InYellowOverBlue ¶
func InYellowOverCyan ¶
func InYellowOverGray ¶
func InYellowOverGreen ¶
func InYellowOverPurple ¶
func InYellowOverRed ¶
func InYellowOverWhite ¶
func InYellowOverYellow ¶
func Ize ¶
Ize is an alias for the Colorize function
Example:
println(color.Ize(color.Red, "This is red"))
func OverBlack ¶
OverBlack wraps the given string s in BlackBackground
Example:
println(color.OverBlack("This is over black"))
func OverBlue ¶
OverBlue wraps the given string s in BlueBackground
Example:
println(color.OverBlue("This is over blue"))
func OverCyan ¶
OverCyan wraps the given string s in CyanBackground
Example:
println(color.OverCyan("This is over cyan"))
func OverGray ¶
OverGray wraps the given string s in GrayBackground
Example:
println(color.OverGray("This is over gray"))
func OverGreen ¶
OverGreen wraps the given string s in GreenBackground
Example:
println(color.OverGreen("This is over green"))
func OverPurple ¶
OverPurple wraps the given string s in PurpleBackground
Example:
println(color.OverPurple("This is over purple"))
func OverRed ¶
OverRed wraps the given string s in RedBackground
Example:
println(color.OverRed("This is over red"))
func OverWhite ¶
OverWhite wraps the given string s in WhiteBackground
Example:
println(color.OverWhite("This is over white"))
func OverYellow ¶
OverYellow wraps the given string s in YellowBackground
Example:
println(color.OverYellow("This is over yellow"))
func Toggle ¶
func Toggle(enable bool)
Toggle enables or disables color output
Note that this does not apply if you are coloring by concatenating strings with color variables directly (e.g. color.Red+"Hello"+color.Reset). Enabling/disabling coloring only applies to all functions (Colorize, Ize, With, InRed, OverRed, etc.)
Types ¶
This section is empty.