theme

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package theme is the single source of truth for nib's visual language: a calm, warm-editorial palette of foreground-only inks (no background is ever set, so nib respects the user's terminal theme), typographic glyphs (no emoji), and the lipgloss styles built from them. Both the TUI (tui/) and the CLI (cmd/cli.go) render through these styles so the two modes look like one product.

Index

Constants

View Source
const (
	BrandName = "nib"

	HelpDefault      = "enter send · ctrl+y use command · esc exit"
	HelpApproval     = "1 once · 2 always · 3 this turn · n no · e edit · esc deny"
	HelpApprovalEdit = "enter submit · esc cancel"
	ApproveEditHint  = "describe the change · enter submit · esc cancel"

	// The numbered approval menu. Line 2 is dynamic — the TUI composes
	// ApproveAlwaysPrefix + chat.GrantScope(...) + ApproveAlwaysSuffix.
	ApproveOnce         = "[1] run it once"
	ApproveAlwaysPrefix = "[2] always allow "
	ApproveAlwaysSuffix = "  (this session)"
	ApproveTurn         = "[3] yes to everything this turn"
	ApproveDenyEdit     = "[n] no · [e] edit"

	EmptyTagline = "a calm assistant for your terminal."
	EmptyTryLead = "try:"
	EmptySlash   = "type /  for skills, agents & commands"
	SlashHint    = "/ for skills"
	Starting     = "starting…"

	CLIWelcome = "a calm assistant for your terminal."
	CLIExit    = "ctrl+c or 'exit' to leave · 'help' for commands"

	// Shown when --yolo / NIB_YOLO auto-approves every tool call. The header
	// carries the compact badge; the CLI prints the fuller notice at startup.
	YoloBadge  = "yolo"
	YoloNotice = "yolo — auto-approving every tool call (no prompts)"
)

Microcopy — calm, lowercase, no wizard metaphor, no emoji.

View Source
const (
	VerbThinking = "thinking"
	VerbWorking  = "working"
	VerbReading  = "reading"
)

Status verbs shown while the agent works.

Variables

View Source
var (
	Accent = lipgloss.Color("173") // clay — brand, prompt, affordances
	Sage   = lipgloss.Color("108") // muted green — success / done
	Danger = lipgloss.Color("131") // muted brick — errors / denials
	Dim    = lipgloss.Color("245") // labels, rules, help
	Faint  = lipgloss.Color("240") // ghost hints, metadata
)

Inks — 256-color, foreground only. Body text uses the terminal default fg.

View Source
var (
	Sep            = "·"  // separator between label and message / list items
	PromptGlyph    = "›"  // input prompt
	ApprovalGutter = "▏"  // left rule on a tool-approval block
	SubAgent       = "↳"  // sub-agent line marker
	Cross          = "×"  // error marker
	Arrow          = "→"  // tool-call / edit / mapping arrow
	Loop           = "↻"  // recurring-loop footer marker
	Goal           = "◎"  // active-goal footer marker
	ShellJob       = "▷"  // shell-jobs footer marker
	ScrollKeys     = "↑↓" // up/down navigation hint
	ReasoningGlyph = "✻"  // marks a block of model thinking/reasoning
)

Glyphs — typographic marks, no emoji. These are vars, not consts, because RestrictedGlyphs() swaps the non-Latin-1 marks for ASCII stand-ins at startup (see init below). Render through these names rather than hardcoding the rune so a single switch covers every call site.

View Source
var (
	Brand      = lipgloss.NewStyle().Bold(true).Foreground(Accent)
	Rule       = lipgloss.NewStyle().Foreground(Dim)
	LabelYou   = lipgloss.NewStyle().Foreground(Dim)
	LabelNib   = lipgloss.NewStyle().Foreground(Accent)
	SepStyle   = lipgloss.NewStyle().Foreground(Faint)
	Prompt     = lipgloss.NewStyle().Foreground(Accent)
	Hint       = lipgloss.NewStyle().Foreground(Faint)
	Help       = lipgloss.NewStyle().Foreground(Dim)
	Meta       = lipgloss.NewStyle().Foreground(Faint)
	Reasoning  = lipgloss.NewStyle().Foreground(Dim).Italic(true)
	Subtle     = lipgloss.NewStyle().Foreground(Dim).Italic(true)
	Error      = lipgloss.NewStyle().Foreground(Danger)
	Gutter     = lipgloss.NewStyle().Foreground(Accent)
	ApproveKey = lipgloss.NewStyle().Bold(true).Foreground(Accent)
	Running    = lipgloss.NewStyle().Foreground(Accent)
	Done       = lipgloss.NewStyle().Foreground(Sage)
	// Yolo flags the auto-approve-everything mode — bold brick so it reads as a
	// standing warning that the approval gate is off.
	Yolo = lipgloss.NewStyle().Bold(true).Foreground(Danger)
)

Styles. Bold is reserved for the brand mark and the active approval keys.

View Source
var EmptyExamples = []string{
	"what changed in the last commit?",
	"undo my last git commit",
	"find every TODO in this repo",
}

EmptyExamples are the sample prompts shown on the first-run empty state.

Functions

func CLIApprovePrompt

func CLIApprovePrompt(alwaysScope string) string

CLIApprovePrompt builds the line-based CLI approval prompt (the TUI uses the numbered single-key menu instead). alwaysScope describes what `a` grants for this call — e.g. "`git …`", "any bash command", or a tool name.

func ReasoningHeader

func ReasoningHeader() string

ReasoningHeader renders the labeled header that tags a block of model thinking, so it reads as a distinct channel from the assistant's answer: an accent glyph (✻ / * in restricted mode) and a dim, non-italic label. The body beneath is rendered with the Reasoning style by the caller.

func RestrictedGlyphs

func RestrictedGlyphs() bool

RestrictedGlyphs reports whether glyphs must fall back to ASCII because the terminal can only render a fixed bitmap font with no arrows, geometric shapes, or eighth-block glyphs. The Linux VT console (TERM=linux) is the canonical case — there, the unmapped runes paint as blank cells. NIB_ASCII overrides the autodetection: "1"/"true"/"yes" forces the stand-ins on any terminal, "0"/"false"/"no" forces the full set.

func Status

func Status(verb string, phase int) string

Status renders a verb with an animated trailing run of dots: phase 0 → "thinking", 1 → "thinking.", 2 → "thinking..", 3 → "thinking…".

Types

This section is empty.

Jump to

Keyboard shortcuts

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