textstyle

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute string

Attribute represents a console text attribute (color or style).

const (
	Bold         Attribute = "1"
	Italic       Attribute = "3"
	Underline    Attribute = "4"
	ReverseVideo Attribute = "7"
	CrossedOut   Attribute = "9"
)
const (
	Black   Attribute = "30"
	Red     Attribute = "31"
	Green   Attribute = "32"
	Yellow  Attribute = "33"
	Blue    Attribute = "34"
	Magenta Attribute = "35"
	Cyan    Attribute = "36"
	White   Attribute = "37"
)

Foreground colors

const (
	BgBlack   Attribute = "40"
	BgRed     Attribute = "41"
	BgGreen   Attribute = "42"
	BgYellow  Attribute = "43"
	BgBlue    Attribute = "44"
	BgMagenta Attribute = "45"
	BgCyan    Attribute = "46"
	BgWhite   Attribute = "47"
)

Background colors

func (Attribute) Sprint

func (attr Attribute) Sprint(a ...any) string

Sprint formats a string with this Attribute.

func (Attribute) Sprintf

func (attr Attribute) Sprintf(format string, a ...any) string

Sprintf formats a string with this Attribute using fmt.Sprintf syntax.

type Text

type Text struct {
	// contains filtered or unexported fields
}

Text represents a collection of console text attributes.

func NewText

func NewText(attributes ...Attribute) *Text

NewText creates a new Text with the given attributes.

func (*Text) Sprint

func (c *Text) Sprint(a ...any) string

Sprint formats a string using the Text's attributes.

func (*Text) Sprintf

func (c *Text) Sprintf(format string, a ...any) string

Sprintf formats a string using the Text's attributes and fmt.Sprintf syntax.

Jump to

Keyboard shortcuts

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