Documentation
¶
Index ¶
- Variables
- func Error(w io.Writer, message string)
- func ErrorIcon() string
- func FormatFilePath(path string) string
- func FormatPosition(line int) string
- func GetSeverityIcon(severity string) string
- func GetSeverityStyle(severity string) lipgloss.Style
- func Info(w io.Writer, message string)
- func InfoIcon() string
- func PrintJSON(w io.Writer, data interface{})
- func PrintYAML(w io.Writer, data interface{})
- func RenderCodeLine(lineNum int, content string, isError bool) string
- func RenderHighlightIndicator(startCol, length int) string
- func RenderSuggestion(title, description string, examples []string, docsURL string) string
- func Success(w io.Writer, message string)
- func SuccessIcon() string
- func SuccessString(message string) string
- func Warning(w io.Writer, message string)
- func WarningIcon() string
- type Spinner
- type SpinnerManager
- type TerminalSpinner
- type TestOption
- type TestSpinner
- func (s *TestSpinner) Color(colors ...string) error
- func (s *TestSpinner) Lock()
- func (s *TestSpinner) SetFinalMSG(finalMSG string)
- func (s *TestSpinner) SetSuffix(suffix string)
- func (s *TestSpinner) Start()
- func (s *TestSpinner) Stop()
- func (s *TestSpinner) Unlock()
- func (s *TestSpinner) UpdateCharSet(cs []string)
- func (s *TestSpinner) UpdateSpeed(d time.Duration)
Constants ¶
This section is empty.
Variables ¶
var ( // Base colors (dark terminal themes) MidnightColor = "#0D1B2A" // midnight LanternColor = "#F4D58D" // lantern ChameleonColor = "#3A7D44" // chameleon ForestColor = "#1E5128" // forest SunsetColor = "#D88A60" // sunset OffWhiteColor = "#F8F9FA" // offwhite WarmGrayColor = "#CED4DA" // warmgray ErrorBaseColor = "#2D1B1B" // error // Base colors (light terminal themes) LightLanternColor = "#E6A645" // dark lantern LightWarmGrayColor = "#8B949E" // dark warmgray LightOffWhiteColor = "#F1F3F4" // dark offwhite LightErrorBaseColor = "#FDEAEA" // dark errorbg // Adaptive color definitions for light/dark themes // Error colors - using sunset for better contrast ErrorColor = compat.AdaptiveColor{ Light: lipgloss.Color(SunsetColor), Dark: lipgloss.Color(SunsetColor), } // Warning colors - using lantern for visibility WarningColor = compat.AdaptiveColor{ Light: lipgloss.Color(LightLanternColor), Dark: lipgloss.Color(LanternColor), } // Success colors - using chameleon/forest SuccessColor = compat.AdaptiveColor{ Light: lipgloss.Color(ForestColor), Dark: lipgloss.Color(ChameleonColor), } // Info colors - using navy for light, lantern for dark InfoColor = compat.AdaptiveColor{ Light: lipgloss.Color(NavyColor), Dark: lipgloss.Color(LanternColor), } // Muted/secondary text MutedColor = compat.AdaptiveColor{ Light: lipgloss.Color(LightWarmGrayColor), Dark: lipgloss.Color(WarmGrayColor), } // Accent/primary colors AccentColor = compat.AdaptiveColor{ Light: lipgloss.Color(ChameleonColor), Dark: lipgloss.Color(LanternColor), } // Code/monospace text CodeColor = compat.AdaptiveColor{ Light: lipgloss.Color(MidnightColor), Dark: lipgloss.Color(MidnightColor), } // Primary text color PrimaryTextColor = compat.AdaptiveColor{ Light: lipgloss.Color(MidnightColor), Dark: lipgloss.Color(OffWhiteColor), } // Background colors PrimaryBgColor = compat.AdaptiveColor{ Light: lipgloss.Color(OffWhiteColor), Dark: lipgloss.Color(MidnightColor), } SecondaryBgColor = compat.AdaptiveColor{ Light: lipgloss.Color(LightOffWhiteColor), Dark: lipgloss.Color(NavyColor), } // Error background for highlighting ErrorBgColor = compat.AdaptiveColor{ Light: lipgloss.Color(LightErrorBaseColor), Dark: lipgloss.Color(ErrorBaseColor), } )
Color palette - standardized across the application
var ( // Base styles using adaptive colors ErrorStyle = lipgloss.NewStyle().Foreground(ErrorColor).Bold(true) WarningStyle = lipgloss.NewStyle().Foreground(WarningColor).Bold(true) SuccessStyle = lipgloss.NewStyle().Foreground(SuccessColor).Bold(true) InfoStyle = lipgloss.NewStyle().Foreground(InfoColor).Bold(true) MutedStyle = lipgloss.NewStyle().Foreground(MutedColor) AccentStyle = lipgloss.NewStyle().Foreground(AccentColor) // Component styles FileStyle = lipgloss.NewStyle(). Foreground(AccentColor). Bold(true). Underline(true) PositionStyle = lipgloss.NewStyle(). Foreground(MutedColor). Italic(true) TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(PrimaryTextColor) MessageStyle = lipgloss.NewStyle(). Foreground(PrimaryTextColor) CodeStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(OffWhiteColor)). Background(CodeColor). Padding(1, 1) LineNumberStyle = lipgloss.NewStyle(). Foreground(MutedColor). Width(5). Align(lipgloss.Right) ErrorLineStyle = lipgloss.NewStyle(). Background(ErrorBgColor) HighlightStyle = lipgloss.NewStyle(). Foreground(ErrorColor). Bold(true) SuggestionTitleStyle = lipgloss.NewStyle(). Foreground(SuccessColor). Bold(true) SuggestionStyle = lipgloss.NewStyle(). Foreground(MutedColor) DocsLinkStyle = lipgloss.NewStyle(). Foreground(InfoColor). Underline(true) // Box styles with adaptive borders ErrorBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ErrorColor). Padding(1, 2). Margin(1, 0) WarningBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(WarningColor). Padding(1, 2). Margin(1, 0) InfoBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(InfoColor). Padding(1, 2). Margin(1, 0) ContextBoxStyle = lipgloss.NewStyle(). Border(lipgloss.Border{ Top: "─", Bottom: "─", Left: "│", Right: "│", TopLeft: "╭", TopRight: "╮", BottomLeft: "╰", BottomRight: "╯", }). BorderForeground(MutedColor). Padding(0, 1). Margin(0, 2) )
var ( StepRunningStyle = lipgloss.NewStyle(). Foreground(InfoColor) StepCompletedStyle = lipgloss.NewStyle(). Foreground(SuccessColor). Bold(true) StepFailedStyle = lipgloss.NewStyle(). Foreground(ErrorColor). Bold(true) StepNameStyle = lipgloss.NewStyle(). Foreground(PrimaryTextColor) DurationStyle = lipgloss.NewStyle(). Foreground(MutedColor). Italic(true) )
Progress styles for run command
Functions ¶
func FormatFilePath ¶
formatFilePath formats a file path with proper styling
func FormatPosition ¶
formatPosition formats a position (line:column) with proper styling
func GetSeverityIcon ¶
getSeverityIcon returns the appropriate icon for the severity level
func GetSeverityStyle ¶
getSeverityStyle returns the appropriate style for the severity level
func RenderCodeLine ¶
renderCodeLine renders a line of code with optional highlighting
func RenderHighlightIndicator ¶
renderHighlightIndicator renders the caret indicators below an error line
func RenderSuggestion ¶
renderSuggestion renders a suggestion with proper styling
func SuccessIcon ¶
func SuccessIcon() string
func SuccessString ¶
Success prints a success message with styling
func WarningIcon ¶
func WarningIcon() string
Types ¶
type SpinnerManager ¶
type SpinnerManager struct {
// contains filtered or unexported fields
}
func NewSpinnerManager ¶
func NewSpinnerManager(w io.Writer) *SpinnerManager
func (*SpinnerManager) Start ¶
func (s *SpinnerManager) Start() Spinner
type TerminalSpinner ¶
type TerminalSpinner struct {
// contains filtered or unexported fields
}
func NewTerminalSpinner ¶
func (*TerminalSpinner) SetFinalMSG ¶
func (s *TerminalSpinner) SetFinalMSG(finalMSG string)
func (*TerminalSpinner) SetSuffix ¶
func (s *TerminalSpinner) SetSuffix(suffix string)
func (*TerminalSpinner) Start ¶
func (s *TerminalSpinner) Start()
func (*TerminalSpinner) Stop ¶
func (s *TerminalSpinner) Stop()
type TestOption ¶
type TestOption func(*TestSpinner)
type TestSpinner ¶
type TestSpinner struct {
ID string
Delay time.Duration
Prefix string
Suffix string
FinalMSG string
Writer io.Writer
HideCursor bool // kept for interface compatibility but ignored
PreUpdate func(s *TestSpinner)
PostUpdate func(s *TestSpinner)
// contains filtered or unexported fields
}
TestSpinner is a spinner implementation for testing that outputs each spinner update on a new line instead of clearing and redrawing
func NewTestSpinner ¶
func NewTestSpinner(cs []string, d time.Duration, options ...TestOption) *TestSpinner
New provides a pointer to an instance of TestSpinner with the supplied options.
func (*TestSpinner) Color ¶
func (s *TestSpinner) Color(colors ...string) error
Color will set the struct field for the given color to be used.
func (*TestSpinner) Lock ¶
func (s *TestSpinner) Lock()
Lock allows for manual control to lock the spinner.
func (*TestSpinner) SetFinalMSG ¶
func (s *TestSpinner) SetFinalMSG(finalMSG string)
func (*TestSpinner) SetSuffix ¶
func (s *TestSpinner) SetSuffix(suffix string)
func (*TestSpinner) Unlock ¶
func (s *TestSpinner) Unlock()
Unlock allows for manual control to unlock the spinner.
func (*TestSpinner) UpdateCharSet ¶
func (s *TestSpinner) UpdateCharSet(cs []string)
UpdateCharSet will change the current character set to the given one.
func (*TestSpinner) UpdateSpeed ¶
func (s *TestSpinner) UpdateSpeed(d time.Duration)
UpdateSpeed will set the indicator delay to the given value.