styles

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTheme = Theme{

	Primary:   lipgloss.Color("86"),
	Secondary: lipgloss.Color("212"),
	Accent:    lipgloss.Color("99"),

	Success: lipgloss.Color("42"),
	Warning: lipgloss.Color("214"),
	Error:   lipgloss.Color("196"),
	Info:    lipgloss.Color("39"),

	Background: lipgloss.Color("235"),
	Foreground: lipgloss.Color("255"),
	Border:     lipgloss.Color("86"),
	BorderDim:  lipgloss.Color("240"),

	TextNormal: lipgloss.Color("255"),
	TextDim:    lipgloss.Color("245"),
	TextBright: lipgloss.Color("231"),

	UserColor:      lipgloss.Color("39"),
	AssistantColor: lipgloss.Color("212"),
	ToolColor:      lipgloss.Color("214"),
	SystemColor:    lipgloss.Color("245"),
}

DefaultTheme is the default Loom color scheme.

Functions

func GenerateDistinctColor

func GenerateDistinctColor(index int) color.Color

GenerateDistinctColor generates a visually distinct color for the given index. Uses golden ratio (φ ≈ 1.618) to distribute hues evenly in HSL color space. This ensures maximum visual distinction even with many agents.

func Width

func Width(s lipgloss.Style, text string) int

Width returns the width needed for the given text with style.

Types

type CompactStyles

type CompactStyles struct {
	*Styles
	IsCompact bool
}

CompactStyles returns styles optimized for compact mode (reduced padding and spacing).

func NewCompactStyles

func NewCompactStyles(theme Theme) *CompactStyles

NewCompactStyles creates styles for compact mode.

type CrushStyles

type CrushStyles struct {
	Theme CrushTheme

	// Base styles
	Base     lipgloss.Style
	Title    lipgloss.Style
	Subtitle lipgloss.Style
	Muted    lipgloss.Style
	Subtle   lipgloss.Style

	// Message styles
	MessageHeader       lipgloss.Style
	MessageUser         lipgloss.Style
	MessageAssistant    lipgloss.Style
	MessageTool         lipgloss.Style
	MessageSystem       lipgloss.Style
	MessageSeparator    lipgloss.Style
	MessageBorder       lipgloss.Style
	MessageContentBlock lipgloss.Style

	// Input styles
	InputFocused lipgloss.Style
	InputBlurred lipgloss.Style
	InputPrompt  lipgloss.Style

	// Status styles
	StatusBar       lipgloss.Style
	ToolPending     lipgloss.Style
	ToolSuccess     lipgloss.Style
	ToolError       lipgloss.Style
	ToolCancelled   lipgloss.Style
	ProgressSpinner lipgloss.Style

	// Layout styles
	PageContainer lipgloss.Style
	DialogOverlay lipgloss.Style
	HelpText      lipgloss.Style
}

CrushStyles creates Crush-styled components.

func NewCrushStyles

func NewCrushStyles() *CrushStyles

NewCrushStyles creates a complete Crush-styled UI system.

type CrushTheme

type CrushTheme struct {
	// Primary interaction colors
	Primary   color.Color
	Secondary color.Color
	Tertiary  color.Color
	Accent    color.Color

	// Background palette
	BgBase        color.Color
	BgBaseLighter color.Color
	BgSubtle      color.Color
	BgOverlay     color.Color

	// Foreground palette
	FgBase      color.Color
	FgMuted     color.Color
	FgHalfMuted color.Color
	FgSubtle    color.Color
	FgSelected  color.Color

	// Status colors
	Success color.Color
	Error   color.Color
	Warning color.Color
	Info    color.Color

	// Semantic colors for tools and operations
	GreenDark  color.Color
	GreenLight color.Color
	RedDark    color.Color
	RedLight   color.Color
	Blue       color.Color
	Purple     color.Color
	Orange     color.Color

	// Special colors
	White  color.Color
	Cherry color.Color

	// Border colors
	Border      color.Color
	BorderFocus color.Color

	// Agent-specific colors (for multi-agent conversations)
	Agent1Color color.Color // Primary agent (purple)
	Agent2Color color.Color // Secondary agent (cyan)
	Agent3Color color.Color // Tertiary agent (green)
	Agent4Color color.Color // Quaternary agent (orange)
	Agent5Color color.Color // Quinary agent (pink)
	Agent6Color color.Color // Senary agent (yellow)
}

CrushTheme implements a Crush-inspired color scheme. Based on Charm Bracelet's Crush TUI visual design.

func CurrentTheme

func CurrentTheme() *CrushTheme

CurrentTheme returns the current global theme. This provides compatibility with Crush-style components that expect styles.CurrentTheme().

func NewCrushTheme

func NewCrushTheme() CrushTheme

NewCrushTheme creates a Crush-inspired theme.

func (*CrushTheme) GetAgentColor

func (t *CrushTheme) GetAgentColor(agentIndex int) color.Color

GetAgentColor returns a distinct color for the given agent index (0-based). Uses predefined colors for first 6 agents, then generates distinct colors using HSL color space for unlimited agents.

type EnhancedTheme

type EnhancedTheme struct {
	Theme

	// Additional background shades
	BgBaseLighter color.Color
	BgSubtle      color.Color
	BgOverlay     color.Color

	// Additional foreground shades
	FgHalfMuted color.Color
	FgSelected  color.Color

	// Extended palette
	Blues   []color.Color
	Greens  []color.Color
	Reds    []color.Color
	Yellows []color.Color
	Grays   []color.Color
}

EnhancedTheme extends the base theme with additional visual options inspired by Charm Bracelet's Crush TUI.

func EnhancedDefaultTheme

func EnhancedDefaultTheme() EnhancedTheme

EnhancedDefaultTheme returns an enhanced version of the default theme with additional color options.

type Icons

type Icons struct {
	// Status & Feedback
	Check   string
	Error   string
	Warning string
	Info    string
	Hint    string

	// Loading & Animation
	Spinner       string
	CenterSpinner string
	Loading       string

	// Navigation & Content
	ArrowRight string
	Document   string
	Model      string

	// Tool Operations
	Pending string
	Success string
	Failed  string

	// Borders & Containers
	BorderThin  string
	BorderThick string

	// Task Management
	TodoCompleted string
	TodoPending   string

	// Model switching
	ModelIcon  string
	SwitchIcon string

	// Permission
	PermissionIcon string
	ApproveIcon    string
	DenyIcon       string

	// Sidebar
	WarningIcon string
	PlayIcon    string
}

Icons contains visual symbols for terminal UI elements. Inspired by Charm Bracelet's Crush TUI.

func DefaultIcons

func DefaultIcons() *Icons

DefaultIcons returns the default icon set.

type Styles

type Styles struct {
	Theme Theme

	// App styles
	App       lipgloss.Style
	Header    lipgloss.Style
	Footer    lipgloss.Style
	StatusBar lipgloss.Style

	// Message styles
	MessageUser      lipgloss.Style
	MessageAssistant lipgloss.Style
	MessageTool      lipgloss.Style
	MessageSystem    lipgloss.Style

	// Input styles
	InputBox    lipgloss.Style
	InputPrompt lipgloss.Style

	// List styles
	ListItem         lipgloss.Style
	ListItemSelected lipgloss.Style

	// Info styles
	SessionInfo lipgloss.Style
	CostInfo    lipgloss.Style
	ErrorInfo   lipgloss.Style

	// Help styles
	HelpKey   lipgloss.Style
	HelpValue lipgloss.Style

	// Text styles
	TextDim lipgloss.Style
}

Styles contains all styled components.

func DefaultStyles

func DefaultStyles() *Styles

DefaultStyles returns the default styles.

func NewStyles

func NewStyles(theme Theme) *Styles

NewStyles creates a new Styles with the given theme.

func (*Styles) FormatCost

func (s *Styles) FormatCost(costUSD float64) string

FormatCost formats cost information for display.

func (*Styles) FormatError

func (s *Styles) FormatError(err error) string

FormatError formats an error message for display.

func (*Styles) FormatSessionID

func (s *Styles) FormatSessionID(sessionID string) string

FormatSessionID formats a session ID for display.

func (*Styles) FormatSuccess

func (s *Styles) FormatSuccess(msg string) string

FormatSuccess formats a success message for display.

type Theme

type Theme struct {
	// Main colors
	Primary   color.Color
	Secondary color.Color
	Accent    color.Color

	// Status colors
	Success color.Color
	Warning color.Color
	Error   color.Color
	Info    color.Color

	// UI colors
	Background color.Color
	Foreground color.Color
	Border     color.Color
	BorderDim  color.Color

	// Text colors
	TextNormal color.Color
	TextDim    color.Color
	TextBright color.Color

	// Role colors (for chat)
	UserColor      color.Color
	AssistantColor color.Color
	ToolColor      color.Color
	SystemColor    color.Color
}

Theme defines the color scheme for the TUI.

Jump to

Keyboard shortcuts

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