Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintF ¶
Printf applies ANSI escape codes to a given pattern string and prints the formatted string with the provided arguments. The pattern string can contain tags followed by content token for various styles and colors, which will be replaced by the corresponding ANSI codes. You can scape token with \@.
Supported styles: B: BOLD. U: UNDERLINE. S: STRIKE. I: ITALIC.
Supported backgrounds: rb: RED. gb: GREEN. yb: YELLOW. bb: BLUE. pb: PURPLE. cb: CYAN. wb: WHITE.
Supported colors: r: RED. g: GREEN. y: YELLOW. b: BLUE. p: PURPLE. c: CYAN. w: WHITE.
Arguments: - format: The string containing the standard go fmt format with styled tokens. - args: The arguments to be passed into the format string.
code block:
PrintF("@Bg{Bold Green Text} and @rb{Red %s}\n", "message")
Types ¶
type MessagePrinter ¶
type MessagePrinter interface {
// Indent add indent to message.
Indent() MessagePrinter
// Red make message title red.
Red(title string) MessagePrinter
// Green make message title green.
Green(title string) MessagePrinter
// Yellow make message title yellow.
Yellow(title string) MessagePrinter
// Blue make message title blue.
Blue(title string) MessagePrinter
// Purple make message title purple.
Purple(title string) MessagePrinter
// Cyan make message title cyan.
Cyan(title string) MessagePrinter
// Underline add underline style to message details.
Underline() MessagePrinter
// Strike add strike style to message details.
Strike() MessagePrinter
// Italic add italic style to message details.
Italic() MessagePrinter
// Tags add tags to message.
Tags(tags ...string) MessagePrinter
// Print print message
Print(message string)
// Printf print message with fmt style
Printf(pattern string, args ...any)
}
MessagePrinter print a colored message (Title: [tags] message).
func Message ¶
func Message() MessagePrinter