ansicolor

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHex = errors.New("invalid HEX color code")
View Source
var InvalidColor = Color{/* contains filtered or unexported fields */}

Functions

func Format added in v0.2.0

func Format(text string, fmtf Flag) string

func Text

func Text(text string, fg, bg Color, flags Flag) string

Types

type Color

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

func HEX added in v0.2.0

func HEX(hex string) (c Color)

HEX converts a hex color code to an Color.

func RGB added in v0.2.0

func RGB(r, g, b byte) Color

func (Color) RGB added in v0.2.0

func (c Color) RGB() color.RGBA

type Flag added in v0.1.2

type Flag uint32
const (
	Reset Flag = 1 << iota
	Bold
	Faint
	Italic
	Underline
	Reverse
	Conceal
	CrossedOut
	Overlined
	BrightForeground
	BrightBackground
)

type Style added in v0.2.0

type Style struct {
	FG     Color
	BG     Color
	Format Flag
}

func (Style) String added in v0.2.0

func (s Style) String(text string) string

type Theme added in v0.2.0

type Theme struct {
	Primary        Color // Primary color for standard text
	Secondary      Color // Secondary color for accentuating text
	Accent         Color // Accent color for highlighting text
	Success        Color // Color for success messages
	Info           Color // Color for informational messages
	Warning        Color // Color for warning messages
	Error          Color // Color for error messages
	Debug          Color // Color for debugging messages
	Notice         Color // Color for notice messages
	NotImplemented Color // Color for not implemented features
	Deprecated     Color // Color for deprecated features or elements
	BUG            Color // Color for bug reports or critical issues
	Light          Color // Light color
	Dark           Color // Dark color
	Muted          Color // Muted color
}

func New added in v0.2.0

func New() Theme

Jump to

Keyboard shortcuts

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