tui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package tui provides an interactive terminal user interface for markata-go.

The TUI is built using Bubble Tea and provides a k9s-inspired interface for browsing and managing site content.

Features

  • Post list with filtering and sorting
  • Tag browsing
  • Feed navigation
  • Vim-like keybindings

Usage

markata-go tui

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPaletteNameFromConfig

func GetPaletteNameFromConfig(extra map[string]interface{}) string

GetPaletteNameFromConfig extracts the palette name from config.Extra.

Types

type Colors

type Colors struct {
	// Header/title colors
	Header lipgloss.Color

	// Subtle/muted text colors
	Subtle lipgloss.Color

	// Selected/highlighted item colors
	Selected     lipgloss.Color
	SelectedBg   lipgloss.Color
	SelectedText lipgloss.Color

	// Border colors
	Border      lipgloss.Color
	BorderFocus lipgloss.Color

	// Table colors
	TableHeader   lipgloss.Color
	TableCell     lipgloss.Color
	TableSelected lipgloss.Color

	// Menu colors
	MenuFg lipgloss.Color
	MenuBg lipgloss.Color
}

Colors holds resolved colors for TUI styling. These are mapped from palette semantic colors to TUI-specific uses.

func DefaultColors

func DefaultColors() *Colors

DefaultColors returns fallback colors when no palette is configured. These match the original hardcoded ANSI codes for backward compatibility.

func LoadColors

func LoadColors(paletteName string) *Colors

LoadColors loads TUI colors from a palette. If the palette cannot be loaded, returns default colors.

type FilterContext

type FilterContext struct {
	Type string // "tag" or "feed"
	Name string // The tag name or feed name
}

FilterContext tracks the active filter for drill-down navigation

type Mode

type Mode string

Mode represents the input mode

const (
	ModeNormal  Mode = "normal"
	ModeFilter  Mode = "filter"
	ModeCommand Mode = "command"
)

type Model

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

Model is the main Bubble Tea model

func NewModel

func NewModel(app *services.App) Model

NewModel creates a new TUI model with default theme.

func NewModelWithTheme

func NewModelWithTheme(app *services.App, theme *Theme) Model

NewModelWithTheme creates a new TUI model with the specified theme. If theme is nil, the default theme is used.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (Model) View

func (m Model) View() string

View renders the UI

type Theme

type Theme struct {
	Colors *Colors

	// Pre-built styles
	HeaderStyle       lipgloss.Style
	SubtleStyle       lipgloss.Style
	SelectedStyle     lipgloss.Style
	DetailLabelStyle  lipgloss.Style
	DetailBoxStyle    lipgloss.Style
	DetailStatusStyle lipgloss.Style
	SortMenuStyle     lipgloss.Style
}

Theme holds the Lipgloss styles for the TUI. Styles are initialized from Colors.

func DefaultTheme

func DefaultTheme() *Theme

DefaultTheme returns a theme with default colors.

func NewTheme

func NewTheme(colors *Colors) *Theme

NewTheme creates a new Theme from colors.

type View

type View string

View represents different TUI views

const (
	ViewPosts      View = "posts"
	ViewTags       View = "tags"
	ViewFeeds      View = "feeds"
	ViewHelp       View = "help"
	ViewPostDetail View = "post_detail"
	ViewConfig     View = "config"
)

Jump to

Keyboard shortcuts

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