tui

package
v0.0.0-...-de5fa36 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DarkTheme is the default dark color theme
	DarkTheme = Theme{
		Name:           "dark",
		Background:     lipgloss.Color("#0a0e14"),
		TaskBackground: lipgloss.Color("#1a1f29"),
		Foreground:     lipgloss.Color("#b3b1ad"),
		Dimmed:         lipgloss.Color("#6b7280"),
		Bright:         lipgloss.Color("#ffffff"),
		Success:        lipgloss.Color("#10b981"),
		Error:          lipgloss.Color("#ef4444"),
		Warning:        lipgloss.Color("#f59e0b"),
		Info:           lipgloss.Color("#0ea5e9"),
		Primary:        lipgloss.Color("#6366f1"),
		Secondary:      lipgloss.Color("#8b5cf6"),
	}

	// LightTheme is a light color theme
	LightTheme = Theme{
		Name:           "light",
		Background:     lipgloss.Color("#f9fafb"),
		TaskBackground: lipgloss.Color("#ffffff"),
		Foreground:     lipgloss.Color("#1f2937"),
		Dimmed:         lipgloss.Color("#9ca3af"),
		Bright:         lipgloss.Color("#000000"),
		Success:        lipgloss.Color("#059669"),
		Error:          lipgloss.Color("#dc2626"),
		Warning:        lipgloss.Color("#d97706"),
		Info:           lipgloss.Color("#0284c7"),
		Primary:        lipgloss.Color("#4f46e5"),
		Secondary:      lipgloss.Color("#7c3aed"),
	}

	// HighContrastTheme is a high contrast theme
	HighContrastTheme = Theme{
		Name:           "high-contrast",
		Background:     lipgloss.Color("#000000"),
		TaskBackground: lipgloss.Color("#000000"),
		Foreground:     lipgloss.Color("#ffffff"),
		Dimmed:         lipgloss.Color("#808080"),
		Bright:         lipgloss.Color("#ffffff"),
		Success:        lipgloss.Color("#00ff00"),
		Error:          lipgloss.Color("#ff0000"),
		Warning:        lipgloss.Color("#ffff00"),
		Info:           lipgloss.Color("#00ffff"),
		Primary:        lipgloss.Color("#ff00ff"),
		Secondary:      lipgloss.Color("#00ffff"),
	}
)

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the main TUI application

func NewApp

func NewApp(cfg *config.Config, engine *game.Engine, client *api.Client, roundType string) *App

NewApp creates a new TUI application

func (*App) Init

func (a *App) Init() tea.Cmd

Init initializes the application

func (*App) Run

func (a *App) Run() error

Run starts the TUI application

func (*App) Update

func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates state

func (*App) View

func (a *App) View() string

View renders the application

type Styles

type Styles struct {
	Theme Theme

	// Layout styles
	App     lipgloss.Style
	Header  lipgloss.Style
	Footer  lipgloss.Style
	Content lipgloss.Style

	// Task display styles
	PreviousTask lipgloss.Style
	CurrentTask  lipgloss.Style
	NextTask     lipgloss.Style
	Separator    lipgloss.Style

	// Status styles
	StatusNormal   lipgloss.Style
	StatusInsert   lipgloss.Style
	StatusVisual   lipgloss.Style
	StatusComplete lipgloss.Style
	StatusError    lipgloss.Style
	StatusProgress lipgloss.Style

	// Text styles
	Title    lipgloss.Style
	Subtitle lipgloss.Style
	Label    lipgloss.Style
	Value    lipgloss.Style
	Hint     lipgloss.Style

	// Stats styles
	Grade       lipgloss.Style
	StatLabel   lipgloss.Style
	StatValue   lipgloss.Style
	ProgressBar lipgloss.Style

	// Help styles
	HelpKey  lipgloss.Style
	HelpDesc lipgloss.Style
}

Styles holds all the lipgloss styles for the TUI

func NewStyles

func NewStyles(theme Theme) *Styles

NewStyles creates a new Styles instance with the given theme

func (*Styles) BufferStyle

func (s *Styles) BufferStyle(status string) lipgloss.Style

BufferStyle returns the appropriate style for buffer text based on match status

func (*Styles) GradeStyle

func (s *Styles) GradeStyle(grade string) lipgloss.Style

GradeStyle returns the appropriate style for a grade

func (*Styles) ModeStyle

func (s *Styles) ModeStyle(mode string) lipgloss.Style

ModeStyle returns the appropriate style for a vim mode

type Theme

type Theme struct {
	Name string

	// Backgrounds
	Background     lipgloss.Color
	TaskBackground lipgloss.Color

	// Text colors
	Foreground lipgloss.Color
	Dimmed     lipgloss.Color
	Bright     lipgloss.Color

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

	// Accent colors
	Primary   lipgloss.Color
	Secondary lipgloss.Color
}

Theme represents a color theme

func GetTheme

func GetTheme(name string) Theme

GetTheme returns a theme by name

type View

type View int

View represents the current screen

const (
	ViewMenu View = iota
	ViewGame
	ViewStats
	ViewHelp
)

Jump to

Keyboard shortcuts

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