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 ¶
Types ¶
type Mode ¶
type Mode int
Mode selects a glyph capability rung.
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.