theme

package
v0.36.4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package theme holds the lipgloss styles shared by the model and its panels: a rounded-border panel box (bright when focused, dim otherwise), a panel title, and the status line.

Kept tiny and dependency-free so both ux and panels can import it without a cycle.

Index

Constants

View Source
const ModalChromeW = 2 + 2*modalPadH

ModalChromeW is how many columns a modal's frame costs on top of its text.

The padding on both sides, plus a border column on each.

For an overlay whose text WRAPS, and which therefore has to choose a width the terminal can hold. An overlay whose lines cannot be broken should not use this to clip itself - wrapping a laid-out table is worse than letting it run off the edge.

Variables

This section is empty.

Functions

func Accent

func Accent() lipgloss.Style

Accent styles the app name / emphasised header text.

func Chip

func Chip() lipgloss.Style

Chip styles a small standing badge in the header.

Currently the h: help hint, which has to survive a crowded header line without being mistaken for one more status field.

func Dim added in v0.36.4

func Dim() lipgloss.Style

Dim styles secondary text that should recede.

Currently a diagnostic's trailing code, which is a lookup key rather than something read on every row.

Shares its colour with Status; they are separate functions because they are separate decisions, and a status line that stopped being dim should not drag the diagnostics pane with it.

func Dir

func Dir() lipgloss.Style

Dir styles a directory row in the source tree.

func Follower

func Follower() lipgloss.Style

Follower styles a cross-ref line in the pane that is MIRRORING the driver.

A muted tint of Selected, so at a glance it is obvious which pane leads and which one is being dragged along.

func Gutter

func Gutter() lipgloss.Style

Gutter styles the link markers in the spec pane's and source viewer's gutter.

Dim on purpose: they are a hint about what is navigable, not content.

func Match

func Match() lipgloss.Style

Match styles a search hit in the spec pane.

func Modal() lipgloss.Style

Modal styles a centered popup box (e.g. the scanner-options dialog).

It sizes to its content, which is right for a modal showing all of itself at once. An overlay that SCROLLS must use ModalAt instead: left to size itself, the frame tracks whichever lines happen to be visible and the box changes width as the content scrolls under it.

func ModalAt added in v0.36.4

func ModalAt(textW int) lipgloss.Style

ModalAt is Modal pinned to a fixed width of textW columns of TEXT.

The padding is added back on top, because lipgloss counts padding INSIDE the width it is given: a caller passing the width it measured its own text at would otherwise have its longest lines wrapped by exactly the padding - which is both wrong and hard to see, since it only bites the widest line.

func Panel

func Panel(w, h int, focused bool) lipgloss.Style

Panel returns a rounded-border box style whose OUTER dimensions are w×h (the border consumes one cell on each side).

The border is bright when focused and dim otherwise.

func Selected

func Selected() lipgloss.Style

Selected styles the cursor row in a navigable panel - the DRIVER line, i.e. the one the user is actually moving.

Strong reverse-video bar.

func SevError

func SevError() lipgloss.Style

SevError styles an error-severity diagnostic label.

SevError, SevWarn and SevHint colour the severity label in the diagnostics pane red, amber and blue, matching the order of the severities themselves.

func SevHint

func SevHint() lipgloss.Style

SevHint styles a hint-severity diagnostic label.

func SevWarn

func SevWarn() lipgloss.Style

SevWarn styles a warning-severity diagnostic label.

func Stale

func Stale() lipgloss.Style

Stale styles the follow-mode badge shown while the source buffer has unsaved edits.

That is the state in which the cross-ref positions are older than what is on screen.

func Status

func Status() lipgloss.Style

Status styles the bottom status and help line.

func Syntax

func Syntax(k SyntaxKind) lipgloss.Style

Syntax returns the style for a syntax class.

The diagnostic classes underline as well as recolour: underline is the terminal's squiggle, and it survives a palette where the severity colour is close to a syntax one.

func Title

func Title(focused bool) lipgloss.Style

Title styles a panel's header line.

Types

type Span

type Span struct {
	Col  int // 1-based column of the run's first character
	Kind SyntaxKind
}

Span is one lexical run on a rendered line, identified by where it STARTS.

A run extends to the next span's column (or the end of the line), which is what lets the renderer slice raw text at known boundaries instead of truncating already-coloured output - the operation that corrupts escapes.

type SyntaxKind

type SyntaxKind uint8

SyntaxKind classifies a lexical run for highlighting.

It is deliberately source-language-neutral: the JSON or YAML lexers and go/scanner both map onto it, so the renderer and the palette are shared rather than duplicated per pane.

const (
	SyntaxPlain SyntaxKind = iota
	SyntaxKey
	SyntaxString
	SyntaxNumber
	SyntaxKeyword
	SyntaxPunct
	SyntaxComment
	SyntaxDiagError
	SyntaxDiagWarn
	SyntaxDiagHint
)

The syntax classes.

Plain is the zero value, so an unmapped token simply renders unstyled rather than wrong.

The Diag* classes are the exception to "lexical": they are not what a token IS but what the scanner said ABOUT it, overlaid on the run the diagnostic points at. They ride the same span mechanism because a diagnostic and a token address the same thing - a (line, column) run - and giving them a second mechanism would mean two ways to paint one line.

Jump to

Keyboard shortcuts

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