Documentation
¶
Index ¶
- Variables
- func ShouldUseColor() bool
- func WithColor(colorEnabled bool, style StyleFunc, text string) string
- type Color
- type ColorScheme
- type Colorizer
- func (c *Colorizer) Accent(text string) string
- func (c *Colorizer) Bold(text string) string
- func (c *Colorizer) Dim(text string) string
- func (c *Colorizer) Error(text string) string
- func (c *Colorizer) Info(text string) string
- func (c *Colorizer) Success(text string) string
- func (c *Colorizer) Warning(text string) string
- type Layout
- func (l *Layout) Box(text string, title string) string
- func (l *Layout) Center(text string) string
- func (l *Layout) Divider(char string) string
- func (l *Layout) Indent(text string, level int) string
- func (l *Layout) List(items []string, bullet string) string
- func (l *Layout) NumberedList(items []string) string
- func (l *Layout) Table(headers []string, rows [][]string) string
- func (l *Layout) Width() int
- func (l *Layout) Wrap(text string, indent int) string
- type Style
- type StyleFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default color scheme with muted professional colors DefaultScheme = ColorScheme{ Success: colorMutedGreen, Warning: colorMutedGold, Error: colorMutedRed, Info: colorMutedBlue, Dim: colorMutedGray, Accent: colorMutedPurple, } // No-color scheme for plain text NoColorScheme = ColorScheme{ Error: Color{ANSI: ""}, Warning: Color{ANSI: ""}, Success: Color{ANSI: ""}, Info: Color{ANSI: ""}, Dim: Color{ANSI: ""}, Accent: Color{ANSI: ""}, } )
Predefined colors using 256-color ANSI codes for consistent muted professional palette.
View Source
var ( // ErrorStyle for error messages ErrorStyle = func(text string) string { return NewStyle(colorMutedRed).Bold().Apply(text) } // WarningStyle for warning messages WarningStyle = func(text string) string { return NewStyle(colorMutedGold).Apply(text) } // SuccessStyle for success messages SuccessStyle = func(text string) string { return NewStyle(colorMutedGreen).Apply(text) } // InfoStyle for informational messages InfoStyle = func(text string) string { return NewStyle(colorMutedBlue).Apply(text) } // EmphasisStyle for emphasized text EmphasisStyle = func(text string) string { return NewStyle(Color{}).Bold().Apply(text) } // DimStyle for secondary text DimStyle = func(text string) string { return NewStyle(colorMutedGray).Apply(text) } // CodeStyle for code/paths CodeStyle = func(text string) string { return text } // PathStyle for file paths PathStyle = func(text string) string { return NewStyle(colorMutedBlue).Apply(text) } // AccentStyle for accent text AccentStyle = func(text string) string { return NewStyle(colorMutedPurple).Apply(text) } )
Predefined style functions for common use cases.
Functions ¶
func ShouldUseColor ¶
func ShouldUseColor() bool
ShouldUseColor determines if color output should be enabled.
Types ¶
type ColorScheme ¶
type ColorScheme struct {
Error Color
Warning Color
Success Color
Info Color
Dim Color
Accent Color
}
ColorScheme defines a color palette.
func GetScheme ¶
func GetScheme() ColorScheme
GetScheme returns the appropriate color scheme based on environment.
type Colorizer ¶
type Colorizer struct {
// contains filtered or unexported fields
}
Colorizer provides semantic color functions for consistent CLI output.
func NewColorizer ¶
NewColorizer creates a colorizer with the appropriate scheme.
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
Layout provides text layout utilities.
func NewLayoutAuto ¶
func NewLayoutAuto() *Layout
NewLayoutAuto creates a layout with automatic width detection.
func (*Layout) NumberedList ¶
NumberedList formats items as a numbered list.
Click to show internal directories.
Click to hide internal directories.