formatutil

package
v0.3.5-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package formatutil manipulates string colors and other formatting operations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Bold formats the arguments in bold for terminals
	Bold = Color("\033[1m%s\033[0m")
	// Faint format the arguments in faint for terminals
	Faint = Color("\033[2m%s\033[0m")
	// Italic formats the arguments in italic for terminals
	Italic = Color("\033[3m%s\033[0m")
	// Red formats the arguments in red for terminals
	Red = Color("\033[1;31m%s\033[0m")
	// Green formats the arguments in green for terminals
	Green = Color("\033[1;32m%s\033[0m")
	// Yellow formats the arguments in yellow for terminals
	Yellow = Color("\033[1;33m%s\033[0m")
	// Purple formats the arguments in purple for terminals
	Purple = Color("\033[1;34m%s\033[0m")
	// Magenta formats the arguments in magenta for terminals
	Magenta = Color("\033[1;35m%s\033[0m")
	// Cyan formats the arguments in cyan for terminals
	Cyan = Color("\033[1;36m%s\033[0m")
	// White formats the arguments in white for terminals
	White = Color("\033[1;37m%s\033[0m")
)

Functions

func Color

func Color(colorString string) func(...interface{}) string

Color is a formatter helper that wraps the arguments suing the color string provided. Checks whether the standard output is a terminal.

func Sanitize

func Sanitize(s string) string

Sanitize is a simple sanitizer that removes all escape sequences

func SanitizeRepr

func SanitizeRepr(s fmt.Stringer) string

SanitizeRepr is a simple sanitizer that removes all escape sequences from the string representation of an object

Types

This section is empty.

Jump to

Keyboard shortcuts

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