Documentation
¶
Index ¶
- func Black() support.Printer
- func Blue() support.Printer
- func CaptureOutput(f func(w io.Writer)) string
- func Cyan() support.Printer
- func Debugf(format string, a ...any)
- func Debugln(a ...any)
- func Default() support.Printer
- func Errorf(format string, a ...any)
- func Errorln(a ...any)
- func Gray() support.Printer
- func Green() support.Printer
- func Infof(format string, a ...any)
- func Infoln(a ...any)
- func Magenta() support.Printer
- func New(color Color) support.Printer
- func Print(a ...any)
- func Printf(format string, a ...any)
- func Printfln(format string, a ...any)
- func Println(a ...any)
- func Red() support.Printer
- func Sprint(a ...any) string
- func Sprintf(format string, a ...any) string
- func Sprintfln(format string, a ...any) string
- func Sprintln(a ...any) string
- func Successf(format string, a ...any)
- func Successln(a ...any)
- func Warnf(format string, a ...any)
- func Warningf(format string, a ...any)
- func Warningln(a ...any)
- func Warnln(a ...any)
- func White() support.Printer
- func Yellow() support.Printer
- type Color
- func (c Color) Print(a ...any) *support.Printer
- func (c Color) Printf(format string, a ...any) *support.Printer
- func (c Color) Printfln(format string, a ...any) *support.Printer
- func (c Color) Println(a ...any) *support.Printer
- func (c Color) Sprint(a ...interface{}) string
- func (c Color) Sprintf(format string, a ...interface{}) string
- func (c Color) Sprintfln(format string, a ...interface{}) string
- func (c Color) Sprintln(a ...interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureOutput ¶
CaptureOutput simulates capturing of os.stdout with a buffer and returns what was written to the screen
func Print ¶ added in v1.15.0
func Print(a ...any)
Print renders color tags and prints the provided arguments without a newline.
Example:
color.Print("<suc>Hello</>, <red>World</>")
func Printf ¶ added in v1.15.0
Printf formats a string with the provided arguments, renders color tags, and prints the result.
Example:
color.Printf("<red>Error:</> %s\n", err)
func Printfln ¶ added in v1.15.0
Printfln formats a string with the provided arguments, renders color tags, and prints the result with a newline.
Example:
color.Printfln("<success>Success:</> %s", message)
func Println ¶ added in v1.15.0
func Println(a ...any)
Println renders color tags and prints the provided arguments with a newline.
Example:
color.Println("<cyan>Welcome</>, <green>to</>, <yellow>Go</>")
func Sprint ¶ added in v1.15.0
Sprint renders color tags and returns the formatted string.
Example:
result := color.Sprint("<blue>Processing...</>")
func Sprintf ¶ added in v1.15.0
Sprintf formats a string with the provided arguments, renders color tags, and returns the formatted result.
Example:
result := color.Sprintf("<red>Error:</> %s", err)
func Sprintfln ¶ added in v1.15.0
Sprintfln formats a string with the provided arguments, renders color tags, and returns the formatted result with a newline.
Example:
result := color.Sprintfln("<green>Task completed:</> %s", taskName)