prettyprint

package module
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 2 Imported by: 11

README

Description

The prettyprint package provides utilities for formatting strings with ANSI color codes. It includes predefined icons for different message types and functions to format strings with foreground and background colors.

Key Features:

  • Standard Color Formatting: 8 basic foreground colors (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White) and background colors (BlackBg, RedBg, etc.) with both variadic (Red) and formatted (Redf) versions.
  • Intense/Bright Color Support: High-intensity variants of all 8 colors for both foreground (IntenseRed, IntenseGreen, etc.) and background (IntenseRedBg, IntenseGreenBg, etc.) with formatted versions.
  • 8-bit Color Support: Access to the full 256-color palette with Fg8Bit/Bg8Bit functions for precise color control (0-255 range).
  • 24-bit True Color Support: Full RGB color support with Fg24Bit/Bg24Bit functions allowing any RGB combination (0-255 for each component).
  • Text Formatting: Style text with Bold, Dim, Italic, Underline, DoubleUnderline, Strike, and Reverse formatting, each with formatted versions.
  • Advanced Formatting: Format function to apply multiple formatting functions in sequence.
  • Predefined Message Icons: Pre-styled icons for common message types (Complete ✓, Alert !, Fail ✗, Info i) with automatic color coding.
  • Variable Display Helpers: Functions like Var, VarSingleQuote, and VarDoubleQuote for displaying variable names and values with consistent formatting.
  • Input Validation: All color functions validate input ranges and gracefully fall back to plain text for invalid values.

Installation

prettyprint is available using the standard go get command.

Install by running:

go get github.com/engmtcdrm/go-prettyprint

Run tests by running:

go test github.com/engmtcdrm/go-prettyprint

Usage

Using the alias pp makes using the package less verbose.

import pp "github.com/engmtcdrm/go-prettyprint"

Index

Variables

var (
    IconComplete = "[✓]" // IconComplete is the icon for a completed message.
    IconAlert    = "[!]" // IconAlert is the icon for an alerted message.
    IconFailed   = "[✗]" // IconFailed is the icon for a failed message.
    IconInfo     = "[i]" // IconInfo is the icon for an informational message.
)

func Alert

func Alert(msg string) string

Alert returns a string with a yellow exclamation icon and the given message.

func Alertf

func Alertf(msg string, a ...any) string

Alertf returns a string with a yellow exclamation icon and the given formatted message.

func Bg24Bit

func Bg24Bit(r int, g int, b int, a ...any) string

Bg24Bit formats using the default formats for its operands and returns the resulting string with an 24-bit background color. Spaces are added between operands when neither is a string.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Bg24Bitf

func Bg24Bitf(r int, g int, b int, format string, a ...any) string

Bg24Bitf formats according to a format specifier and returns the resulting string with an 24-bit background color.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Bg8Bit

func Bg8Bit(color int, a ...any) string

Bg8Bit formats using the default formats for its operands and returns the resulting string with an 8-bit background color. Spaces are added between operands when neither is a string.

color must be between 0 and 255 otherwise no color will be applied.

func Bg8Bitf

func Bg8Bitf(color int, format string, a ...any) string

Bg8Bitf formats according to a format specifier and returns the resulting string with an 8-bit background color.

color must be between 0 and 255 otherwise no color will be applied.

func Black

func Black(a ...any) string

Black formats using the default formats for its operands and returns the resulting string with a black foreground. Spaces are added between operands when neither is a string.

func BlackBg

func BlackBg(a ...any) string

BlackBg formats using the default formats for its operands and returns the resulting string with a black background. Spaces are added between operands when neither is a string.

func BlackBgf

func BlackBgf(format string, a ...any) string

BlackBgf formats according to a format specifier and returns the resulting string with a black background.

func Blackf

func Blackf(format string, a ...any) string

Blackf formats according to a format specifier and returns the resulting string with a black foreground.

func Blue

func Blue(a ...any) string

Blue formats using the default formats for its operands and returns the resulting string with a blue foreground. Spaces are added between operands when neither is a string.

func BlueBg

func BlueBg(a ...any) string

BlueBg formats using the default formats for its operands and returns the resulting string with a blue background. Spaces are added between operands when neither is a string.

func BlueBgf

func BlueBgf(format string, a ...any) string

BlueBgf formats according to a format specifier and returns the resulting string with a blue background.

func Bluef

func Bluef(format string, a ...any) string

Bluef formats according to a format specifier and returns the resulting string with a blue foreground.

func Bold

func Bold(a ...any) string

Bold formats using the default formats for its operands and returns the resulting string in bold. Spaces are added between operands when neither is a string.

func Boldf

func Boldf(format string, a ...any) string

Boldf formats according to a format specifier and returns the resulting string in bold.

func Complete

func Complete(msg string) string

Complete returns a string with a green checkmark icon and the given message.

func Completef

func Completef(msg string, a ...any) string

Completef returns a string with a green checkmark icon and the given formatted message.

func Cyan

func Cyan(a ...any) string

Cyan formats using the default formats for its operands and returns the resulting string with a cyan foreground. Spaces are added between operands when neither is a string.

func CyanBg

func CyanBg(a ...any) string

CyanBg formats using the default formats for its operands and returns the resulting string with a cyan background. Spaces are added between operands when neither is a string.

func CyanBgf

func CyanBgf(format string, a ...any) string

CyanBgf formats according to a format specifier and returns the resulting string with a cyan background.

func Cyanf

func Cyanf(format string, a ...any) string

Cyanf formats according to a format specifier and returns the resulting string with a cyan foreground.

func Dim

func Dim(a ...any) string

Dim formats using the default formats for its operands and returns the resulting string in dim. Spaces are added between operands when neither is a string.

func Dimf

func Dimf(format string, a ...any) string

Dimf formats according to a format specifier and returns the resulting string in dim.

func DoubleUnderline

func DoubleUnderline(a ...any) string

DoubleUnderline formats using the default formats for its operands and returns the resulting string with a double underline. Spaces are added between operands when neither is a string.

func DoubleUnderlinef

func DoubleUnderlinef(format string, a ...any) string

DoubleUnderlinef formats according to a format specifier and returns the resulting string with a double underline.

func Fail

func Fail(msg string) string

Fail returns a string with a red X icon and the given message.

func Failf

func Failf(msg string, a ...any) string

Failf returns a string with a red X icon and the given formatted message.

func Fg24Bit

func Fg24Bit(r int, g int, b int, a ...any) string

Fg24Bit formats using the default formats for its operands and returns the resulting string with an 24-bit foreground color. Spaces are added between operands when neither is a string.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Fg24Bitf

func Fg24Bitf(r int, g int, b int, format string, a ...any) string

Fg24Bitf formats according to a format specifier and returns the resulting string with an 24-bit foreground color.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Fg8Bit

func Fg8Bit(color int, a ...any) string

Fg8Bit formats using the default formats for its operands and returns the resulting string with an 8-bit foreground color. Spaces are added between operands when neither is a string.

color must be between 0 and 255 otherwise no color will be applied.

func Fg8Bitf

func Fg8Bitf(color int, format string, a ...any) string

Fg8Bitf formats according to a format specifier and returns the resulting string with an 8-bit foreground color.

color must be between 0 and 255 otherwise no color will be applied.

func Format

func Format(msg string, a ...func(...any) string) string

Format applies the given formatting functions to the message in order and returns the resulting string. If no formatting functions are provided, the original message is returned.

func Green

func Green(a ...any) string

Green formats using the default formats for its operands and returns the resulting string with a green foreground. Spaces are added between operands when neither is a string.

func GreenBg

func GreenBg(a ...any) string

GreenBg formats using the default formats for its operands and returns the resulting string with a green background. Spaces are added between operands when neither is a string.

func GreenBgf

func GreenBgf(format string, a ...any) string

GreenBgf formats according to a format specifier and returns the resulting string with a green background.

func Greenf

func Greenf(format string, a ...any) string

Greenf formats according to a format specifier and returns the resulting string with a green foreground.

func Info

func Info(msg string) string

Info returns a string with a cyan info icon and the given message.

func Infof

func Infof(msg string, a ...any) string

Infof returns a string with a cyan info icon and the given formatted message.

func IntenseBlack

func IntenseBlack(a ...any) string

IntenseBlack formats using the default formats for its operands and returns the resulting string with a intense black (gray) foreground. Spaces are added between operands when neither is a string.

func IntenseBlackBg

func IntenseBlackBg(a ...any) string

IntenseBlackBg formats using the default formats for its operands and returns the resulting string with a intense black background. Spaces are added between operands when neither is a string.

func IntenseBlackBgf

func IntenseBlackBgf(format string, a ...any) string

IntenseBlackBgf formats according to a format specifier and returns the resulting string with a intense black background.

func IntenseBlackf

func IntenseBlackf(format string, a ...any) string

IntenseBlackf formats according to a format specifier and returns the resulting string with a intense black (gray) foreground.

func IntenseBlue

func IntenseBlue(a ...any) string

IntenseBlue formats using the default formats for its operands and returns the resulting string with a intense blue foreground. Spaces are added between operands when neither is a string.

func IntenseBlueBg

func IntenseBlueBg(a ...any) string

IntenseBlueBg formats using the default formats for its operands and returns the resulting string with a intense blue background. Spaces are added between operands when neither is a string.

func IntenseBlueBgf

func IntenseBlueBgf(format string, a ...any) string

IntenseBlueBgf formats according to a format specifier and returns the resulting string with a intense blue background.

func IntenseBluef

func IntenseBluef(format string, a ...any) string

IntenseBluef formats according to a format specifier and returns the resulting string with a intense blue foreground.

func IntenseCyan

func IntenseCyan(a ...any) string

IntenseCyan formats using the default formats for its operands and returns the resulting string with a intense cyan foreground. Spaces are added between operands when neither is a string.

func IntenseCyanBg

func IntenseCyanBg(a ...any) string

IntenseCyanBg formats using the default formats for its operands and returns the resulting string with a intense cyan background. Spaces are added between operands when neither is a string.

func IntenseCyanBgf

func IntenseCyanBgf(format string, a ...any) string

IntenseCyanBgf formats according to a format specifier and returns the resulting string with a intense cyan background.

func IntenseCyanf

func IntenseCyanf(format string, a ...any) string

IntenseCyanf formats according to a format specifier and returns the resulting string with a intense cyan foreground.

func IntenseGreen

func IntenseGreen(a ...any) string

IntenseGreen formats using the default formats for its operands and returns the resulting string with a intense green foreground. Spaces are added between operands when neither is a string.

func IntenseGreenBg

func IntenseGreenBg(a ...any) string

IntenseGreenBg formats using the default formats for its operands and returns the resulting string with a intense green background. Spaces are added between operands when neither is a string.

func IntenseGreenBgf

func IntenseGreenBgf(format string, a ...any) string

IntenseGreenBgf formats according to a format specifier and returns the resulting string with a intense green background.

func IntenseGreenf

func IntenseGreenf(format string, a ...any) string

IntenseGreenf formats according to a format specifier and returns the resulting string with a intense green foreground.

func IntenseMagenta

func IntenseMagenta(a ...any) string

IntenseMagenta formats using the default formats for its operands and returns the resulting string with a intense magenta foreground. Spaces are added between operands when neither is a string.

func IntenseMagentaBg

func IntenseMagentaBg(a ...any) string

IntenseMagentaBg formats using the default formats for its operands and returns the resulting string with a intense magenta background. Spaces are added between operands when neither is a string.

func IntenseMagentaBgf

func IntenseMagentaBgf(format string, a ...any) string

IntenseMagentaBgf formats according to a format specifier and returns the resulting string with a intense magenta background.

func IntenseMagentaf

func IntenseMagentaf(format string, a ...any) string

IntenseMagentaf formats according to a format specifier and returns the resulting string with a intense magenta foreground.

func IntenseRed

func IntenseRed(a ...any) string

IntenseRed formats using the default formats for its operands and returns the resulting string with a intense red foreground. Spaces are added between operands when neither is a string.

func IntenseRedBg

func IntenseRedBg(a ...any) string

IntenseRedBg formats using the default formats for its operands and returns the resulting string with a intense red background. Spaces are added between operands when neither is a string.

func IntenseRedBgf

func IntenseRedBgf(format string, a ...any) string

IntenseRedBgf formats according to a format specifier and returns the resulting string with a intense red background.

func IntenseRedf

func IntenseRedf(format string, a ...any) string

IntenseRedf formats according to a format specifier and returns the resulting string with a intense red foreground.

func IntenseWhite

func IntenseWhite(a ...any) string

IntenseWhite formats using the default formats for its operands and returns the resulting string with a intense white foreground. Spaces are added between operands when neither is a string.

func IntenseWhiteBg

func IntenseWhiteBg(a ...any) string

IntenseWhiteBg formats using the default formats for its operands and returns the resulting string with a intense white background. Spaces are added between operands when neither is a string.

func IntenseWhiteBgf

func IntenseWhiteBgf(format string, a ...any) string

IntenseWhiteBgf formats according to a format specifier and returns the resulting string with a intense white background.

func IntenseWhitef

func IntenseWhitef(format string, a ...any) string

IntenseWhitef formats according to a format specifier and returns the resulting string with a intense white foreground.

func IntenseYellow

func IntenseYellow(a ...any) string

IntenseYellow formats using the default formats for its operands and returns the resulting string with a intense yellow foreground. Spaces are added between operands when neither is a string.

func IntenseYellowBg

func IntenseYellowBg(a ...any) string

IntenseYellowBg formats using the default formats for its operands and returns the resulting string with a intense yellow background. Spaces are added between operands when neither is a string.

func IntenseYellowBgf

func IntenseYellowBgf(format string, a ...any) string

IntenseYellowBgf formats according to a format specifier and returns the resulting string with a intense yellow background.

func IntenseYellowf

func IntenseYellowf(format string, a ...any) string

IntenseYellowf formats according to a format specifier and returns the resulting string with a intense yellow foreground.

func Italic

func Italic(a ...any) string

Italic formats using the default formats for its operands and returns the resulting string in italic. Spaces are added between operands when neither is a string.

func Italicf

func Italicf(format string, a ...any) string

Italicf formats according to a format specifier and returns the resulting string in italic.

func Magenta

func Magenta(a ...any) string

Magenta formats using the default formats for its operands and returns the resulting string with a magenta foreground. Spaces are added between operands when neither is a string.

func MagentaBg

func MagentaBg(a ...any) string

MagentaBg formats using the default formats for its operands and returns the resulting string with a magenta background. Spaces are added between operands when neither is a string.

func MagentaBgf

func MagentaBgf(format string, a ...any) string

MagentaBgf formats according to a format specifier and returns the resulting string with a magenta background.

func Magentaf

func Magentaf(format string, a ...any) string

Magentaf formats according to a format specifier and returns the resulting string with a magenta foreground.

func Red

func Red(a ...any) string

Red formats using the default formats for its operands and returns the resulting string with a red foreground. Spaces are added between operands when neither is a string.

func RedAlert

func RedAlert(msg string) string

RedAlert returns a string with a red exclamation icon and the given message.

func RedAlertf

func RedAlertf(msg string, a ...any) string

RedAlertf returns a string with a red exclamation icon and the given formatted message.

func RedBg

func RedBg(a ...any) string

RedBg formats using the default formats for its operands and returns the resulting string with a red background. Spaces are added between operands when neither is a string.

func RedBgf

func RedBgf(format string, a ...any) string

RedBgf formats according to a format specifier and returns the resulting string with a red background.

func Redf

func Redf(format string, a ...any) string

Redf formats according to a format specifier and returns the resulting string with a red foreground.

func Reverse

func Reverse(a ...any) string

Reverse formats using the default formats for its operands and returns the resulting string with reversed foreground and background. Spaces are added between operands when neither is a string.

func Reversef

func Reversef(format string, a ...any) string

Reversef formats according to a format specifier and returns the resulting string with reversed foreground and background.

func Strike

func Strike(a ...any) string

Strike formats using the default formats for its operands and returns the resulting string with a strikethrough. Spaces are added between operands when neither is a string.

func Strikef

func Strikef(format string, a ...any) string

Strikef formats according to a format specifier and returns the resulting string with a strikethrough.

func Underline

func Underline(a ...any) string

Underline formats using the default formats for its operands and returns the resulting string underlined. Spaces are added between operands when neither is a string.

func Underlinef

func Underlinef(format string, a ...any) string

Underlinef formats according to a format specifier and returns the resulting string underlined.

func Var

func Var(variable string, value string) string

Var returns a string with the given variable and value.

func VarDoubleQuote

func VarDoubleQuote(variable string, value string) string

VarDoubleQuote returns a string with the given variable and value, double quoted.

func VarQuote

func VarQuote(variable string, value string) string

VarQuote returns a string with the given variable and value, double quoted. Deprecated: use VarDoubleQuote instead.

func VarSingleQuote

func VarSingleQuote(variable string, value string) string

VarSingleQuote returns a string with the given variable and value, single quoted.

func White

func White(a ...any) string

White formats using the default formats for its operands and returns the resulting string with a white foreground. Spaces are added between operands when neither is a string.

func WhiteBg

func WhiteBg(a ...any) string

WhiteBg formats using the default formats for its operands and returns the resulting string with a white background. Spaces are added between operands when neither is a string.

func WhiteBgf

func WhiteBgf(format string, a ...any) string

WhiteBgf formats according to a format specifier and returns the resulting string with a white background.

func Whitef

func Whitef(format string, a ...any) string

Whitef formats according to a format specifier and returns the resulting string with a white foreground.

func Yellow

func Yellow(a ...any) string

Yellow formats using the default formats for its operands and returns the resulting string with a yellow foreground. Spaces are added between operands when neither is a string.

func YellowBg

func YellowBg(a ...any) string

YellowBg formats using the default formats for its operands and returns the resulting string with a yellow background. Spaces are added between operands when neither is a string.

func YellowBgf

func YellowBgf(format string, a ...any) string

YellowBgf formats according to a format specifier and returns the resulting string with a yellow background.

func Yellowf

func Yellowf(format string, a ...any) string

Yellowf formats according to a format specifier and returns the resulting string with a yellow foreground.

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IconComplete = "[✓]" // IconComplete is the icon for a completed message.
	IconAlert    = "[!]" // IconAlert is the icon for an alerted message.
	IconFailed   = "[✗]" // IconFailed is the icon for a failed message.
	IconInfo     = "[i]" // IconInfo is the icon for an informational message.
)

Functions

func Alert

func Alert(msg string) string

Alert returns a string with a yellow exclamation icon and the given message.

func Alertf added in v1.2.0

func Alertf(msg string, a ...any) string

Alertf returns a string with a yellow exclamation icon and the given formatted message.

func Bg8Bit added in v1.2.0

func Bg8Bit(color int, a ...any) string

Bg8Bit formats using the default formats for its operands and returns the resulting string with an 8-bit background color. Spaces are added between operands when neither is a string.

color must be between 0 and 255 otherwise no color will be applied.

func Bg8Bitf added in v1.2.0

func Bg8Bitf(color int, format string, a ...any) string

Bg8Bitf formats according to a format specifier and returns the resulting string with an 8-bit background color.

color must be between 0 and 255 otherwise no color will be applied.

func Bg24Bit added in v1.2.0

func Bg24Bit(r int, g int, b int, a ...any) string

Bg24Bit formats using the default formats for its operands and returns the resulting string with an 24-bit background color. Spaces are added between operands when neither is a string.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Bg24Bitf added in v1.2.0

func Bg24Bitf(r int, g int, b int, format string, a ...any) string

Bg24Bitf formats according to a format specifier and returns the resulting string with an 24-bit background color.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Black

func Black(a ...any) string

Black formats using the default formats for its operands and returns the resulting string with a black foreground. Spaces are added between operands when neither is a string.

func BlackBg added in v1.1.0

func BlackBg(a ...any) string

BlackBg formats using the default formats for its operands and returns the resulting string with a black background. Spaces are added between operands when neither is a string.

func BlackBgf added in v1.1.0

func BlackBgf(format string, a ...any) string

BlackBgf formats according to a format specifier and returns the resulting string with a black background.

func Blackf

func Blackf(format string, a ...any) string

Blackf formats according to a format specifier and returns the resulting string with a black foreground.

func Blue

func Blue(a ...any) string

Blue formats using the default formats for its operands and returns the resulting string with a blue foreground. Spaces are added between operands when neither is a string.

func BlueBg added in v1.1.0

func BlueBg(a ...any) string

BlueBg formats using the default formats for its operands and returns the resulting string with a blue background. Spaces are added between operands when neither is a string.

func BlueBgf added in v1.1.0

func BlueBgf(format string, a ...any) string

BlueBgf formats according to a format specifier and returns the resulting string with a blue background.

func Bluef

func Bluef(format string, a ...any) string

Bluef formats according to a format specifier and returns the resulting string with a blue foreground.

func Bold added in v1.2.0

func Bold(a ...any) string

Bold formats using the default formats for its operands and returns the resulting string in bold. Spaces are added between operands when neither is a string.

func Boldf added in v1.2.0

func Boldf(format string, a ...any) string

Boldf formats according to a format specifier and returns the resulting string in bold.

func Complete

func Complete(msg string) string

Complete returns a string with a green checkmark icon and the given message.

func Completef added in v1.2.0

func Completef(msg string, a ...any) string

Completef returns a string with a green checkmark icon and the given formatted message.

func Cyan

func Cyan(a ...any) string

Cyan formats using the default formats for its operands and returns the resulting string with a cyan foreground. Spaces are added between operands when neither is a string.

func CyanBg added in v1.1.0

func CyanBg(a ...any) string

CyanBg formats using the default formats for its operands and returns the resulting string with a cyan background. Spaces are added between operands when neither is a string.

func CyanBgf added in v1.1.0

func CyanBgf(format string, a ...any) string

CyanBgf formats according to a format specifier and returns the resulting string with a cyan background.

func Cyanf

func Cyanf(format string, a ...any) string

Cyanf formats according to a format specifier and returns the resulting string with a cyan foreground.

func Dim added in v1.2.0

func Dim(a ...any) string

Dim formats using the default formats for its operands and returns the resulting string in dim. Spaces are added between operands when neither is a string.

func Dimf added in v1.2.0

func Dimf(format string, a ...any) string

Dimf formats according to a format specifier and returns the resulting string in dim.

func DoubleUnderline added in v1.2.0

func DoubleUnderline(a ...any) string

DoubleUnderline formats using the default formats for its operands and returns the resulting string with a double underline. Spaces are added between operands when neither is a string.

func DoubleUnderlinef added in v1.2.0

func DoubleUnderlinef(format string, a ...any) string

DoubleUnderlinef formats according to a format specifier and returns the resulting string with a double underline.

func Fail

func Fail(msg string) string

Fail returns a string with a red X icon and the given message.

func Failf added in v1.2.0

func Failf(msg string, a ...any) string

Failf returns a string with a red X icon and the given formatted message.

func Fg8Bit added in v1.2.0

func Fg8Bit(color int, a ...any) string

Fg8Bit formats using the default formats for its operands and returns the resulting string with an 8-bit foreground color. Spaces are added between operands when neither is a string.

color must be between 0 and 255 otherwise no color will be applied.

func Fg8Bitf added in v1.2.0

func Fg8Bitf(color int, format string, a ...any) string

Fg8Bitf formats according to a format specifier and returns the resulting string with an 8-bit foreground color.

color must be between 0 and 255 otherwise no color will be applied.

func Fg24Bit added in v1.2.0

func Fg24Bit(r int, g int, b int, a ...any) string

Fg24Bit formats using the default formats for its operands and returns the resulting string with an 24-bit foreground color. Spaces are added between operands when neither is a string.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Fg24Bitf added in v1.2.0

func Fg24Bitf(r int, g int, b int, format string, a ...any) string

Fg24Bitf formats according to a format specifier and returns the resulting string with an 24-bit foreground color.

r, g, and b must be between 0 and 255 otherwise no color will be applied.

func Format added in v1.2.0

func Format(msg string, a ...func(...any) string) string

Format applies the given formatting functions to the message in order and returns the resulting string. If no formatting functions are provided, the original message is returned.

func Green

func Green(a ...any) string

Green formats using the default formats for its operands and returns the resulting string with a green foreground. Spaces are added between operands when neither is a string.

func GreenBg added in v1.1.0

func GreenBg(a ...any) string

GreenBg formats using the default formats for its operands and returns the resulting string with a green background. Spaces are added between operands when neither is a string.

func GreenBgf added in v1.1.0

func GreenBgf(format string, a ...any) string

GreenBgf formats according to a format specifier and returns the resulting string with a green background.

func Greenf

func Greenf(format string, a ...any) string

Greenf formats according to a format specifier and returns the resulting string with a green foreground.

func Info

func Info(msg string) string

Info returns a string with a cyan info icon and the given message.

func Infof added in v1.2.0

func Infof(msg string, a ...any) string

Infof returns a string with a cyan info icon and the given formatted message.

func IntenseBlack added in v1.2.0

func IntenseBlack(a ...any) string

IntenseBlack formats using the default formats for its operands and returns the resulting string with a intense black (gray) foreground. Spaces are added between operands when neither is a string.

func IntenseBlackBg added in v1.2.0

func IntenseBlackBg(a ...any) string

IntenseBlackBg formats using the default formats for its operands and returns the resulting string with a intense black background. Spaces are added between operands when neither is a string.

func IntenseBlackBgf added in v1.2.0

func IntenseBlackBgf(format string, a ...any) string

IntenseBlackBgf formats according to a format specifier and returns the resulting string with a intense black background.

func IntenseBlackf added in v1.2.0

func IntenseBlackf(format string, a ...any) string

IntenseBlackf formats according to a format specifier and returns the resulting string with a intense black (gray) foreground.

func IntenseBlue added in v1.2.0

func IntenseBlue(a ...any) string

IntenseBlue formats using the default formats for its operands and returns the resulting string with a intense blue foreground. Spaces are added between operands when neither is a string.

func IntenseBlueBg added in v1.2.0

func IntenseBlueBg(a ...any) string

IntenseBlueBg formats using the default formats for its operands and returns the resulting string with a intense blue background. Spaces are added between operands when neither is a string.

func IntenseBlueBgf added in v1.2.0

func IntenseBlueBgf(format string, a ...any) string

IntenseBlueBgf formats according to a format specifier and returns the resulting string with a intense blue background.

func IntenseBluef added in v1.2.0

func IntenseBluef(format string, a ...any) string

IntenseBluef formats according to a format specifier and returns the resulting string with a intense blue foreground.

func IntenseCyan added in v1.2.0

func IntenseCyan(a ...any) string

IntenseCyan formats using the default formats for its operands and returns the resulting string with a intense cyan foreground. Spaces are added between operands when neither is a string.

func IntenseCyanBg added in v1.2.0

func IntenseCyanBg(a ...any) string

IntenseCyanBg formats using the default formats for its operands and returns the resulting string with a intense cyan background. Spaces are added between operands when neither is a string.

func IntenseCyanBgf added in v1.2.0

func IntenseCyanBgf(format string, a ...any) string

IntenseCyanBgf formats according to a format specifier and returns the resulting string with a intense cyan background.

func IntenseCyanf added in v1.2.0

func IntenseCyanf(format string, a ...any) string

IntenseCyanf formats according to a format specifier and returns the resulting string with a intense cyan foreground.

func IntenseGreen added in v1.2.0

func IntenseGreen(a ...any) string

IntenseGreen formats using the default formats for its operands and returns the resulting string with a intense green foreground. Spaces are added between operands when neither is a string.

func IntenseGreenBg added in v1.2.0

func IntenseGreenBg(a ...any) string

IntenseGreenBg formats using the default formats for its operands and returns the resulting string with a intense green background. Spaces are added between operands when neither is a string.

func IntenseGreenBgf added in v1.2.0

func IntenseGreenBgf(format string, a ...any) string

IntenseGreenBgf formats according to a format specifier and returns the resulting string with a intense green background.

func IntenseGreenf added in v1.2.0

func IntenseGreenf(format string, a ...any) string

IntenseGreenf formats according to a format specifier and returns the resulting string with a intense green foreground.

func IntenseMagenta added in v1.2.0

func IntenseMagenta(a ...any) string

IntenseMagenta formats using the default formats for its operands and returns the resulting string with a intense magenta foreground. Spaces are added between operands when neither is a string.

func IntenseMagentaBg added in v1.2.0

func IntenseMagentaBg(a ...any) string

IntenseMagentaBg formats using the default formats for its operands and returns the resulting string with a intense magenta background. Spaces are added between operands when neither is a string.

func IntenseMagentaBgf added in v1.2.0

func IntenseMagentaBgf(format string, a ...any) string

IntenseMagentaBgf formats according to a format specifier and returns the resulting string with a intense magenta background.

func IntenseMagentaf added in v1.2.0

func IntenseMagentaf(format string, a ...any) string

IntenseMagentaf formats according to a format specifier and returns the resulting string with a intense magenta foreground.

func IntenseRed added in v1.2.0

func IntenseRed(a ...any) string

IntenseRed formats using the default formats for its operands and returns the resulting string with a intense red foreground. Spaces are added between operands when neither is a string.

func IntenseRedBg added in v1.2.0

func IntenseRedBg(a ...any) string

IntenseRedBg formats using the default formats for its operands and returns the resulting string with a intense red background. Spaces are added between operands when neither is a string.

func IntenseRedBgf added in v1.2.0

func IntenseRedBgf(format string, a ...any) string

IntenseRedBgf formats according to a format specifier and returns the resulting string with a intense red background.

func IntenseRedf added in v1.2.0

func IntenseRedf(format string, a ...any) string

IntenseRedf formats according to a format specifier and returns the resulting string with a intense red foreground.

func IntenseWhite added in v1.2.0

func IntenseWhite(a ...any) string

IntenseWhite formats using the default formats for its operands and returns the resulting string with a intense white foreground. Spaces are added between operands when neither is a string.

func IntenseWhiteBg added in v1.2.0

func IntenseWhiteBg(a ...any) string

IntenseWhiteBg formats using the default formats for its operands and returns the resulting string with a intense white background. Spaces are added between operands when neither is a string.

func IntenseWhiteBgf added in v1.2.0

func IntenseWhiteBgf(format string, a ...any) string

IntenseWhiteBgf formats according to a format specifier and returns the resulting string with a intense white background.

func IntenseWhitef added in v1.2.0

func IntenseWhitef(format string, a ...any) string

IntenseWhitef formats according to a format specifier and returns the resulting string with a intense white foreground.

func IntenseYellow added in v1.2.0

func IntenseYellow(a ...any) string

IntenseYellow formats using the default formats for its operands and returns the resulting string with a intense yellow foreground. Spaces are added between operands when neither is a string.

func IntenseYellowBg added in v1.2.0

func IntenseYellowBg(a ...any) string

IntenseYellowBg formats using the default formats for its operands and returns the resulting string with a intense yellow background. Spaces are added between operands when neither is a string.

func IntenseYellowBgf added in v1.2.0

func IntenseYellowBgf(format string, a ...any) string

IntenseYellowBgf formats according to a format specifier and returns the resulting string with a intense yellow background.

func IntenseYellowf added in v1.2.0

func IntenseYellowf(format string, a ...any) string

IntenseYellowf formats according to a format specifier and returns the resulting string with a intense yellow foreground.

func Italic added in v1.2.0

func Italic(a ...any) string

Italic formats using the default formats for its operands and returns the resulting string in italic. Spaces are added between operands when neither is a string.

func Italicf added in v1.2.0

func Italicf(format string, a ...any) string

Italicf formats according to a format specifier and returns the resulting string in italic.

func Magenta

func Magenta(a ...any) string

Magenta formats using the default formats for its operands and returns the resulting string with a magenta foreground. Spaces are added between operands when neither is a string.

func MagentaBg added in v1.1.0

func MagentaBg(a ...any) string

MagentaBg formats using the default formats for its operands and returns the resulting string with a magenta background. Spaces are added between operands when neither is a string.

func MagentaBgf added in v1.1.0

func MagentaBgf(format string, a ...any) string

MagentaBgf formats according to a format specifier and returns the resulting string with a magenta background.

func Magentaf

func Magentaf(format string, a ...any) string

Magentaf formats according to a format specifier and returns the resulting string with a magenta foreground.

func Red

func Red(a ...any) string

Red formats using the default formats for its operands and returns the resulting string with a red foreground. Spaces are added between operands when neither is a string.

func RedAlert

func RedAlert(msg string) string

RedAlert returns a string with a red exclamation icon and the given message.

func RedAlertf added in v1.2.0

func RedAlertf(msg string, a ...any) string

RedAlertf returns a string with a red exclamation icon and the given formatted message.

func RedBg added in v1.1.0

func RedBg(a ...any) string

RedBg formats using the default formats for its operands and returns the resulting string with a red background. Spaces are added between operands when neither is a string.

func RedBgf added in v1.1.0

func RedBgf(format string, a ...any) string

RedBgf formats according to a format specifier and returns the resulting string with a red background.

func Redf

func Redf(format string, a ...any) string

Redf formats according to a format specifier and returns the resulting string with a red foreground.

func Reverse added in v1.2.0

func Reverse(a ...any) string

Reverse formats using the default formats for its operands and returns the resulting string with reversed foreground and background. Spaces are added between operands when neither is a string.

func Reversef added in v1.2.0

func Reversef(format string, a ...any) string

Reversef formats according to a format specifier and returns the resulting string with reversed foreground and background.

func Strike added in v1.2.0

func Strike(a ...any) string

Strike formats using the default formats for its operands and returns the resulting string with a strikethrough. Spaces are added between operands when neither is a string.

func Strikef added in v1.2.0

func Strikef(format string, a ...any) string

Strikef formats according to a format specifier and returns the resulting string with a strikethrough.

func Underline added in v1.2.0

func Underline(a ...any) string

Underline formats using the default formats for its operands and returns the resulting string underlined. Spaces are added between operands when neither is a string.

func Underlinef added in v1.2.0

func Underlinef(format string, a ...any) string

Underlinef formats according to a format specifier and returns the resulting string underlined.

func Var

func Var(variable string, value string) string

Var returns a string with the given variable and value.

func VarDoubleQuote added in v1.2.0

func VarDoubleQuote(variable string, value string) string

VarDoubleQuote returns a string with the given variable and value, double quoted.

func VarQuote

func VarQuote(variable string, value string) string

VarQuote returns a string with the given variable and value, double quoted. Deprecated: use VarDoubleQuote instead.

func VarSingleQuote added in v1.2.0

func VarSingleQuote(variable string, value string) string

VarSingleQuote returns a string with the given variable and value, single quoted.

func White

func White(a ...any) string

White formats using the default formats for its operands and returns the resulting string with a white foreground. Spaces are added between operands when neither is a string.

func WhiteBg added in v1.1.0

func WhiteBg(a ...any) string

WhiteBg formats using the default formats for its operands and returns the resulting string with a white background. Spaces are added between operands when neither is a string.

func WhiteBgf added in v1.1.0

func WhiteBgf(format string, a ...any) string

WhiteBgf formats according to a format specifier and returns the resulting string with a white background.

func Whitef

func Whitef(format string, a ...any) string

Whitef formats according to a format specifier and returns the resulting string with a white foreground.

func Yellow

func Yellow(a ...any) string

Yellow formats using the default formats for its operands and returns the resulting string with a yellow foreground. Spaces are added between operands when neither is a string.

func YellowBg added in v1.1.0

func YellowBg(a ...any) string

YellowBg formats using the default formats for its operands and returns the resulting string with a yellow background. Spaces are added between operands when neither is a string.

func YellowBgf added in v1.1.0

func YellowBgf(format string, a ...any) string

YellowBgf formats according to a format specifier and returns the resulting string with a yellow background.

func Yellowf

func Yellowf(format string, a ...any) string

Yellowf formats according to a format specifier and returns the resulting string with a yellow foreground.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL