Documentation ¶
Index ¶
- func Black(value ...string) string
- func BlackBg(value ...string) string
- func Blue(value ...string) string
- func BlueBg(value ...string) string
- func BrightBlack(value ...string) string
- func BrightBlackBg(value ...string) string
- func BrightBlue(value ...string) string
- func BrightBlueBg(value ...string) string
- func BrightCyan(value ...string) string
- func BrightCyanBg(value ...string) string
- func BrightGreen(value ...string) string
- func BrightGreenBg(value ...string) string
- func BrightMagenta(value ...string) string
- func BrightMagentaBg(value ...string) string
- func BrightRed(value ...string) string
- func BrightRedBg(value ...string) string
- func BrightWhite(value ...string) string
- func BrightWhiteBg(value ...string) string
- func BrightYellow(value ...string) string
- func BrightYellowBg(value ...string) string
- func Cyan(value ...string) string
- func CyanBg(value ...string) string
- func Green(value ...string) string
- func GreenBg(value ...string) string
- func Magenta(value ...string) string
- func MagentaBg(value ...string) string
- func Red(value ...string) string
- func RedBg(value ...string) string
- func StyledString(val string, styles ...Style) string
- func TextBold(value ...string) string
- func TextDim(value ...string) string
- func TextItalics(value ...string) string
- func TextUnderlined(value ...string) string
- func White(value ...string) string
- func WhiteBg(value ...string) string
- func Yellow(value ...string) string
- func YellowBg(value ...string) string
- type Chalk
- type Style
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BrightBlack ¶
Method to print string with bright red foreground color
func BrightBlackBg ¶
Method to print string with bright black background color
func BrightBlue ¶
Method to print string with bright blue foreground color
func BrightBlueBg ¶
Method to print string with bright blue background color
func BrightCyan ¶
Method to print string with bright cyan foreground color
func BrightCyanBg ¶
Method to print string with bright cyan background color
func BrightGreen ¶
Method to print string with bright green foreground color
func BrightGreenBg ¶
Method to print string with bright green background color
func BrightMagenta ¶
Method to print string with bright magenta foreground color
func BrightMagentaBg ¶
Method to print string with bright magenta background color
func BrightRedBg ¶
Method to print string with bright red background color
func BrightWhite ¶
Method to print string with bight white foreground color
func BrightWhiteBg ¶
Method to print string with bright white background color
func BrightYellow ¶
Method to print string with bright yellow foreground color
func BrightYellowBg ¶
Method to print string with bright yellow background color
func StyledString ¶
Method to apply one or more styles to a string. If no style argument is provided then given string is returned as is.
If multiple foreground / background styles are provided then the last corresponding foreground / background will be applied.
examples:
gochalk.StyledString("Hello World", gochalk.FgRed) // Returns string wrapped in red foreground style gochalk.StyledString("Hello World", gochalk.FgRed, gochalk.FgYellow, gochalk.FgGreen) // only green foreground will be applied gochalk.StyledString("Hello World", gochalk.FgRed, gochalk.Bold) // Returns string with bold and red styles
func TextItalics ¶
Method to print string with italics styling
func TextUnderlined ¶
Method to print string with underlined styling
Types ¶
type Chalk ¶
type Chalk struct {
// contains filtered or unexported fields
}
func NewStyle ¶
Creates a new Chalk object with the provided styles. This object can then be reused to apply required styles to strings If multiple foreground or background colors are provided as parameters, then the last one will be applied
error := gochalk.NewStyle(gochalk.FgRed) // Returns a Chalk object with red foreground style applied
func (*Chalk) Add ¶
Method to add a style to current chalk object. If no parameter given then nothing happens and same object is returned. If Foreground or Background color is provided, it will replace any corresponding foreground / background style If multiple Foreground / Background styles are provided, then only the last corresponding color will be applied
errorChalk := chalk.New(gochalk.FgRed) errorBold := errorChalk.Add(gochalk.Bold) // Adds Bold style to 'error' chalk object warningBold := errorBold.Add(gochalk.FgYellow) // Foreground color red is replaced by yellow colorful := chalk.New(gochalk.FgRed).Add(gochalk.FgYellow, gochalk.FgMagenta) // Multiple colors are provided to Add so magenta is chosen and will replace existing red
func (*Chalk) Remove ¶
Method to remove any present styling from Chalk. If given styling is not present then method will do nothing happens. Method will return a new Chalk
errorBold := gochalk.NewStyle(gochalk.FgRed, gochalk.Bold) errorNormal := gochalk.Remove(gochalk.Bold) // Bold styling will be removed. Will not effect errorBold object as new Chalk is returned
type Style ¶
type Style int
Foreground color (font colors)
const ( FgBrightBlack Style = iota + 90 FgBrightRed FgBrightGreen FgBrightYellow FgBrightBlue FgBrightMagenta FgBrightCyan FgBrightWhite )
Foreground color (font color) - Bright / Hi-intensity
Background Color