colorize

package
v0.0.0-...-b6fc690 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorRed        = lipgloss.Color("1")
	ColorYellow     = lipgloss.Color("3")
	ColorMagenta    = lipgloss.Color("5")
	ColorCyan       = lipgloss.Color("6")
	ColorOrange     = lipgloss.Color("166")
	ColorLightGrey  = lipgloss.Color("248")
	StyleCyan       = lipgloss.NewStyle().Foreground(ColorCyan)
	StyleRed        = lipgloss.NewStyle().Foreground(ColorRed)
	StyleOrange     = lipgloss.NewStyle().Foreground(ColorOrange)
	StyleYellow     = lipgloss.NewStyle().Foreground(ColorYellow)
	StyleMagenta    = lipgloss.NewStyle().Foreground(ColorMagenta)
	StyleLightGrey  = lipgloss.NewStyle().Foreground(ColorLightGrey)
	StyleBold       = lipgloss.NewStyle().Bold(true)
	StyleActionable = lipgloss.NewStyle().Bold(true).Foreground(ColorCyan)
)

Functions

func Colorize

func Colorize(value string, writer io.Writer, stripColors bool) (int, error)

Colorize will replace `[COLORNAME]foo`[/RESET] with shell colors, or strip color tags if stripColors=true

func Colorized

func Colorized(value string, stripColors bool) (string, error)

func ColorizedOrStrip

func ColorizedOrStrip(value string, stripColors bool) string

func StripColorCodes

func StripColorCodes(value string) string

StripColorCodes strips color codes from a string

Types

type ColorTheme

type ColorTheme interface {
	Heading(writer io.Writer)
	Bold(writer io.Writer)
	Notice(writer io.Writer)
	Success(writer io.Writer)
	Error(writer io.Writer)
	Warning(writer io.Writer)
	Disabled(writer io.Writer)
	Actionable(writer io.Writer)
	Cyan(writer io.Writer)
	Green(writer io.Writer)
	Red(writer io.Writer)
	Orange(writer io.Writer)
	Yellow(writer io.Writer)
	Magenta(writer io.Writer)
	Reset(writer io.Writer)
}

type CroppedLine

type CroppedLine struct {
	Line   string
	Length int
}

type CroppedLines

type CroppedLines []CroppedLine

func GetCroppedText

func GetCroppedText(text string, maxLen int, includeLineEnds bool) CroppedLines

func (CroppedLines) String

func (c CroppedLines) String() string

Jump to

Keyboard shortcuts

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