Documentation
¶
Overview ¶
Package icons is hawk's centralized icon registry.
Hawk never emits emoji or one-off Unicode glyphs in its CLI/TUI output. Every glyph hawk renders goes through this package. Each glyph has two forms:
- A Nerd Font PUA (Private Use Area) codepoint (U+E000–U+F8FF). These render as designed icons when the user has any Nerd Font patched font installed (https://www.nerdfonts.com).
- An ASCII fallback. The default. Used on any terminal that does not have a patched font, when stdout is not a TTY (e.g. CI logs, captured output), or when the user sets HAWK_ICONS=ascii.
No emoji block codepoints (U+1F300–U+1FAFF) and no symbol/dingbat block codepoints (U+2600–U+27BF) are used anywhere. The codepoints defined in this file are verified to be in the Unicode PUA by the audit test in internal/testaudit.
Codepoints are derived from:
- Nerd Fonts v3 Codicons (EA60..EC1E) — https://github.com/microsoft/vscode-codicons
- Nerd Fonts v3 FontAwesome (ED00..F2FF) — https://fontawesome.com
- Nerd Fonts v3 Octicons (F400..F533) — https://primer.style/octicons
- Nerd Fonts v3 Pomicons (E000..E00A) — pomodoro set
- Nerd Fonts v3 Custom (E5FA..E6B7) — seti-ui
Why this and not Lucide SVG?
Lucide (https://lucide.dev) is the project's visual identity for docs and web surfaces (see docs/architecture.md). It is an SVG-only icon set — there is no standard PUA mapping for Lucide in Nerd Fonts, so the icon shapes cannot be rendered in a plain terminal. The two realistic options are (a) build and ship a custom Nerd Font that embeds a Lucide subset (large infrastructure dependency, no toolchain in CI), or (b) render Lucide SVGs as Unicode block art at print time (slow, error-prone, breaks captured output). The Go-CLI ecosystem (charmbracelet, spf13/cobra, github/cli, k9s) uses the PUA-or-ASCII approach we have here; the surveys of those projects are recorded in scripts/ICONICONSURVEY.md. The 0-emoji audit in internal/testaudit enforces that policy going forward.
Index ¶
- Constants
- func ASCII(name string) string
- func Alert() string
- func AlertOctagram() string
- func ArrowDown() string
- func ArrowLeft() string
- func ArrowRight() string
- func ArrowUp() string
- func BallotX() string
- func Bell() string
- func Block() string
- func Bolt() string
- func Brain() string
- func Branch() string
- func Cancel() string
- func CaretDown() string
- func CaretRight() string
- func Check() string
- func CheckBold() string
- func CheckCircle() string
- func CheckDecagram() string
- func ChevronRight() string
- func CircleFilled() string
- func CircleHalf() string
- func CircleOutline() string
- func CircleQuarter() string
- func CircleSlice5() string
- func CircleSlice6() string
- func ClockOutline() string
- func Close() string
- func CloseCircle() string
- func CloseThick() string
- func Cog() string
- func Email() string
- func ExpandAll() string
- func File() string
- func FileDocument() string
- func Glyph(name string) string
- func HelpCircle() string
- func Hourglass() string
- func Image() string
- func Key() string
- func Llama() string
- func Magnify() string
- func Mail() string
- func Names() []string
- func Nerd(name string) string
- func Pause() string
- func Pin() string
- func Question() string
- func Refresh() string
- func Reload() string
- func Return() string
- func Robot() string
- func RotateVariant() string
- func SetMode(m IconMode)
- func Stop() string
- func Swap() string
- func Timer() string
- func TriangleSmall() string
- type IconMode
Constants ¶
const ( ASCIIPrompt = ">" ASCIIRobot = "*" ASCIICircleFilled = "*" ASCIICircleOutline = "." ASCIIAlert = "!" ASCIICheck = "+" ASCIICross = "x" ASCIIBallotX = "x" ASCIIBlock = "#" ASCIIReturn = "<-" ASCIIArrowRight = "->" ASCIIArrowLeft = "<-" ASCIIArrowUp = "^" ASCIIArrowDown = "v" ASCIISwap = "<->" ASCIITimer = "[t]" ASCIIReload = "[r]" ASCIIStop = "[x]" ASCIIBell = "[!]" ASCIICheckDecagram = "[ok]" ASCIIAlertOctagram = "[!!]" ASCIICancel = "[x]" ASCIIFile = "[f]" ASCIIQuestion = "?" ASCIIMail = "[m]" ASCIIRefresh = "[r]" ASCIIHourglass = "[..]" ASCIICheckCircle = "[ok]" ASCIICloseCircle = "[x]" ASCIIImage = "[img]" ASCIIFileDocument = "[doc]" ASCIIKey = "[key]" ASCIICog = "[*]" ASCIIMagnify = "/" ASCIIBolt = "!" ASCIIBrain = "[think]" ASCIIEmail = "[m]" ASCIIHelpCircle = "?" ASCIIBranch = "(|)" ASCIIClockOutline = "[t]" ASCIIPause = "[||]" ASCIIExpandAll = "[+]" ASCIICaretRight = ">" ASCIICaretDown = "v" ASCIITriangleSmall = ">" ASCIICircleHalf = "o" ASCIICircleQuarter = "." ASCIICircleSlice5 = "." ASCIICircleSlice6 = "." ASCIIRotateVariant = "[r]" ASCIILlama = "[ollama]" )
ASCII fallback strings. Every glyph in the registry has one. Defaults are single ASCII runes or short bracketed tokens ("[ok]", "[!!]") for state indicators that need more visibility than a single character.
Variables ¶
This section is empty.
Functions ¶
func ASCII ¶
ASCII returns the ASCII fallback for the given name regardless of the active mode. Use this in:
- golden-file tests (stable byte-for-byte expected output)
- log lines that may be shipped to a non-tty destination later
- the TUI when it detects it is being rendered to a captured file
func AlertOctagram ¶
func AlertOctagram() string
func ArrowRight ¶
func ArrowRight() string
func CaretRight ¶
func CaretRight() string
func CheckCircle ¶
func CheckCircle() string
func CheckDecagram ¶
func CheckDecagram() string
func ChevronRight ¶
func ChevronRight() string
func CircleFilled ¶
func CircleFilled() string
func CircleHalf ¶
func CircleHalf() string
func CircleOutline ¶
func CircleOutline() string
func CircleQuarter ¶
func CircleQuarter() string
func CircleSlice5 ¶
func CircleSlice5() string
func CircleSlice6 ¶
func CircleSlice6() string
func ClockOutline ¶
func ClockOutline() string
func CloseCircle ¶
func CloseCircle() string
func CloseThick ¶
func CloseThick() string
func FileDocument ¶
func FileDocument() string
func Glyph ¶
Glyph returns the active-mode glyph for the given name. Panics on unknown names — that is a programmer error, not a runtime condition.
func HelpCircle ¶
func HelpCircle() string
func Nerd ¶
Nerd returns the Nerd Font PUA form for the given name regardless of the active mode. Used by the harness command's "icons" section.
func RotateVariant ¶
func RotateVariant() string
func SetMode ¶
func SetMode(m IconMode)
SetMode overrides detection. Pass ModeAuto to re-enable detection on the next Mode() call. Tests use this to pin behaviour.
func TriangleSmall ¶
func TriangleSmall() string
Types ¶
type IconMode ¶
type IconMode int32
Mode selects which glyph set the icons package returns.
func Mode ¶
func Mode() IconMode
Mode returns the active rendering mode. On first call, resolves ModeAuto from env vars. Subsequent calls return the cached value unless SetMode is used.
Resolution is conservative: ASCII is the default; Nerd Font is enabled only when env markers explicitly indicate a patched terminal is in use AND stdout is a TTY.
Precedence:
- HAWK_ICONS=nerd|ascii → ModeNerd / ModeASCII
- NO_COLOR set → ModeASCII
- !stdoutIsTTY() → ModeASCII (piped output stays clean)
- TERM / TERM_PROGRAM / LC_TERMINAL matches a known Nerd-Font-friendly terminal → ModeNerd
- LANG / LC_ALL / LC_CTYPE contains "UTF-8" → ModeNerd
- otherwise → ModeASCII