pretty

package module
v0.0.0-...-55d7d75 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 2 Imported by: 0

README

Pretty

Pretty printing in the terminal.

fmt.Printf("%v", pretty.New(""}).WithColour(pretty.Red).WithLink("example.com") )
fmt.Printf("%v", pretty.Value{"abc"}.WithColour(pretty.Red).WithLink("example.com") )
fmt.Printf("%v", pretty.Print("abc").WithColour(pretty.Red).WithLink("example.com") )
fmt.Printf("%v", pretty.Print("abc", WithColour(pretty.Red), WithBold(), WithLink(""))

fmt.Printf("%v", pretty.Print("abc", WithColour(pretty.Red), pretty.Bold, WithLink(""))

fmt.Printf("%v", pretty.Print("abc", "xyz", WithColour(pretty.Red), pretty.Bold, WithLink(""))

fmt.PrintLn(pretty.Print("abc", pretty.Gold))

Documentation

Overview

Pretty prints to the terminal using ANSI escape codes.

Index

Constants

View Source
const (
	Black prettyColour = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)
View Source
const (
	BrightGray prettyColour = iota + 90
	BrightRed
	BrightGreen
	BrightYellow
	BrightBlue
	BrightMagenta
	BrightCyan
	BrightWhite
)
View Source
const (
	BackgroundBlack prettyBackgroundColour = iota + 40
	BackgroundRed
	BackgroundGreen
	BackgroundYellow
	BackgroundBlue
	BackgroundMagenta
	BackgroundCyan
	BackgroundWhite
)
View Source
const (
	BackgroundBrightGray prettyBackgroundColour = iota + 100
	BackgroundBrightRed
	BackgroundBrightGreen
	BackgroundBrightYellow
	BackgroundBrightBlue
	BackgroundBrightMagenta
	BackgroundBrightCyan
	BackgroundBrightWhite
)
View Source
const (
	Bold          prettyFormat = 1
	Dim           prettyFormat = 2
	Italic        prettyFormat = 3
	Underline     prettyFormat = 4
	SlowBlink     prettyFormat = 5
	RapidBlink    prettyFormat = 6
	Strikethrough prettyFormat = 9
)

Variables

This section is empty.

Functions

func BackgroundColour

func BackgroundColour(colour prettyBackgroundColour) prettyBackgroundColour

func Colour

func Colour(colour prettyColour) prettyColour

func Printf

func Printf(a any, f ...any)

Applies the supplied formats and prints the result to standard out.

func Println

func Println(a any, f ...any)

Applies the supplied format and prints the result, with trailing newline, to standard out.

func Sprintf

func Sprintf(a any, f ...any) string

Applies the supplied formats and returns the result.

func WithBold

func WithBold() prettyFormat

func WithDim

func WithDim() prettyFormat

func WithItalic

func WithItalic() prettyFormat
func WithRapidBlink() prettyFormat
func WithSlowBlink() prettyFormat

func WithStrikethrough

func WithStrikethrough() prettyFormat

func WithUnderline

func WithUnderline() prettyFormat

Types

type BackgroundRgb

type BackgroundRgb Rgb

func WithBackgroundRgb

func WithBackgroundRgb(r, g, b uint8) BackgroundRgb
type Link string
func WithLink(url string) Link

type Rgb

type Rgb struct {
	Red   uint8
	Green uint8
	Blue  uint8
}

func WithRgb

func WithRgb(r, g, b uint8) Rgb

Jump to

Keyboard shortcuts

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