Documentation
¶
Index ¶
- Constants
- Variables
- func ClearStatusAfter(duration time.Duration, msgID int) tea.Cmd
- func Footer() string
- func GetAdaptiveColor(darkColor, lightColor lipgloss.Color) lipgloss.Color
- func Header() string
- func RenderStatusBar(width int, s spinner.Model, message string, isLoading bool) string
- func ResetForegroundColor() string
- func Run(model tea.Model, opts ...tea.ProgramOption) (tea.Model, error)
- func SetAnsiForegroundColor(hexColor lipgloss.Color) string
- type ClearStatusMsg
- type InterruptibleModel
Constants ¶
const ( DrPurple = lipgloss.Color("#7770F9") // purple-60 DrPurpleLight = lipgloss.Color("#B4B0FF") // purple-40 DrIndigo = lipgloss.Color("#5C41FF") // indigo-70 DrRed = lipgloss.Color("#9A3131") // red-80 DrGreen = lipgloss.Color("#81FBA5") // green-60 DrYellow = lipgloss.Color("#F6EB61") // yellow-60 DrBlack = lipgloss.Color("#0B0B0B") // black-90 )
DataRobot brand colors, utilizing the Design System palette
const ( DrPurpleDark = lipgloss.Color("#5500DD") // Darker purple DrPurpleDarkLight = lipgloss.Color("#7755DD") // Darker purple-light DrIndigoDark = lipgloss.Color("#4400FF") // Darker indigo DrGreenDark = lipgloss.Color("#00AA00") // Darker green DrYellowDark = lipgloss.Color("#AA8800") // Darker yellow DrGray = lipgloss.Color("252") // Light gray for dark backgrounds DrGrayDark = lipgloss.Color("240") // Dark gray for light backgrounds )
Light mode color variants (darker for visibility on light backgrounds)
const Banner = `` /* 1398-byte string literal not displayed */
Banner contains the DataRobot ASCII art logo
const DebugLogFile = "dr-tui-debug.log"
DebugLogFile is the filename for TUI debug logs
const DebugLogLevelWidth = 5
Variables ¶
var ( BaseTextStyle = lipgloss.NewStyle().Foreground(GetAdaptiveColor(DrPurple, DrPurpleDark)) ErrorStyle = lipgloss.NewStyle().Foreground(DrRed).Bold(true) InfoStyle = lipgloss.NewStyle().Foreground(GetAdaptiveColor(DrPurpleLight, DrPurpleDarkLight)).Bold(true) DimStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240")) // Specific UI styles LogoStyle = BaseTextStyle WelcomeStyle = BaseTextStyle.Bold(true) SubTitleStyle = BaseTextStyle.Bold(true). Foreground(DrPurpleLight). BorderBottom(true). BorderStyle(lipgloss.NormalBorder()). BorderForeground(DrGreen) BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(DrPurple). Padding(1, 2) NoteBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(GetAdaptiveColor(DrPurpleLight, DrPurpleDarkLight)). Padding(0, 1) StatusBarStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(DrPurpleLight). Foreground(DrPurpleLight). Padding(0, 1) )
Common style definitions using DataRobot branding
var DebugLogStyles = func() *log.Styles { styles := log.DefaultStyles() for level, style := range styles.Levels { styles.Levels[level] = style.MaxWidth(DebugLogLevelWidth).PaddingRight(1) } return styles }()
DebugLogStyles customizes the log styles for debug logging in the TUI
Functions ¶
func ClearStatusAfter ¶ added in v0.2.14
func GetAdaptiveColor ¶ added in v0.2.11
GetAdaptiveColor returns a color that works on both light and dark backgrounds
func RenderStatusBar ¶ added in v0.2.7
RenderStatusBar creates a status bar with optional spinner and message. Based on lipgloss layout example.
func ResetForegroundColor ¶ added in v0.2.3
func ResetForegroundColor() string
func Run ¶ added in v0.2.28
Run is a wrapper for tea.NewProgram and (p *Program) Run() Configures debug logging for the TUI if debug mode is enabled Wraps a model in NewInterruptibleModel
func SetAnsiForegroundColor ¶ added in v0.2.3
Types ¶
type ClearStatusMsg ¶ added in v0.2.14
type ClearStatusMsg struct {
MsgID int
}
type InterruptibleModel ¶ added in v0.1.5
InterruptibleModel wraps any Bubble Tea model to ensure Ctrl-C always works. This wrapper intercepts ALL messages before they reach the underlying model, checking for Ctrl-C and immediately quitting if detected. This guarantees users can never get stuck in the program, regardless of what the model does.
func NewInterruptibleModel ¶ added in v0.1.5
func NewInterruptibleModel(model tea.Model) InterruptibleModel
NewInterruptibleModel wraps a model to ensure Ctrl-C always works everywhere. Use this when creating any Bubble Tea program to guarantee users can exit.
Example:
m := myModel{}
p := tea.NewProgram(tui.NewInterruptibleModel(m), tea.WithAltScreen())
func (InterruptibleModel) Init ¶ added in v0.1.5
func (m InterruptibleModel) Init() tea.Cmd
func (InterruptibleModel) View ¶ added in v0.1.5
func (m InterruptibleModel) View() string