icons

package
v0.267.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package icons resolves the process-wide glyph set: auto (the default, which promotes to Nerd Font only on a positive signal), an explicit Nerd Font rung, a universal Unicode fallback, or off for decorative glyphs. The playground's ctrl+g re-resolves it at runtime, so the choice is not fixed at startup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(m Mode)

Apply activates a mode for the whole process, resolving ModeAuto through Detect first so sets is only ever indexed by a concrete rung.

Types

type Mode

type Mode int

Mode selects a glyph capability rung.

const (
	ModeNerdFont Mode = iota
	ModeUnicode
	ModeOff
	// ModeAuto is a resolution-time value only: Apply turns it into a concrete
	// rung via Detect. It is never a key into sets and never reaches Current.
	ModeAuto
)

func Current added in v0.267.0

func Current() Mode

Current returns the active rung after any auto resolution. The playground's glyph-cycle key needs it to know where the cycle starts.

func Detect added in v0.267.0

func Detect() Mode

Detect guesses a glyph rung from the environment. It returns only ModeNerdFont or ModeUnicode: ModeOff is a deliberate user choice and is never auto-selected.

No reliable Nerd Font probe exists — the cursor-position trick measures cell advance width, not glyph presence, and a missing glyph still advances one cell. So this only ever promotes from the safe unicode baseline on a positive signal. The errors are asymmetric: guessing nerdfont wrongly prints "?" on every tab, while guessing unicode wrongly costs slightly plainer icons.

The result is memoized because two entry points (main and the playground's launch) each resolve the same auto rung, and the font-directory walk behind it is not free. Nothing the guess depends on — env, TTY-ness, installed fonts — can meaningfully change within one process.

func Parse

func Parse(s string) Mode

Parse maps a config string to a Mode. The accepted values are "auto" (default), "nerdfont", "unicode" and "off"; an empty string means the default, and any other value warns on stderr before falling back to auto.

type Set

type Set struct {
	Profile, Store, Model, Tuple, Change, Query, Assert, APILog string
	Dot, Caret, Check, Cross                                    string
	CapL, CapR                                                  string // powerline chip caps
}

Set holds every glyph the UI uses.

func I

func I() Set

I returns the active glyph set.

Jump to

Keyboard shortcuts

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