Skip to content

Icons: OpenIcon built in and on by default, icon("mail") draws the best glyph - #95

Merged
ralyodio merged 2 commits into
mainfrom
openicon-pack
Sep 24, 2026
Merged

ralyodio merged 2 commits into
mainfrom
openicon-pack

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

OpenIcon (https://logicsrc.com/openicon) becomes hqtui's default, enabled icon pack.

import { icon, setIconMode } from "@profullstack/hqtui";
ui.text(`${icon("mail")} Inbox  ${icon("git-branch")} main`);
// 󰇰 Inbox   main  (Nerd Font) · ✉ Inbox  ⎇ main (UTF-8) · @ Inbox  Y main (ASCII)
  • Glyph choice, in order: setIconMode() → OPENICON_GLYPHS / HQTUI_ICONS → NERD_FONT=1 → the existing detectCapabilities Unicode check. A Nerd Font is never assumed, because the font cannot be detected from inside the terminal.

  • Fallbacks: aliases resolve (email → mail), an icon with no Nerd glyph falls back to Unicode, and an unknown name returns "" rather than throwing mid-frame.

  • Custom sets: useIconPack(iconPackFrom(openiconJson)) swaps in any other OpenIcon set.

  • 370 icons: 259 UI icons and 111 brands. The table is generated by packages/hqtui/scripts/generate-icons.ts from github.com/profullstack/openicon into:

    • the TS library (src/icons-data.ts)
    • Go (ports/go/icons_data.go, Icon, IconIn, IconModeIn)
    • Python (hqtui.icon, icon_mode)
    • Rust (hqtui::icon, icon_in, icon_mode_in)

    The Rust table is sorted and binary-searched. The only change to existing code is detect_unicode, which becomes pub(crate).

  • Docs: a new Icons section at hqtui.com/docs#icons and in the package README.

Tests, run locally:

  • TypeScript: node --test 337/337 and bun test packages/hqtui/test 337 pass; 7 are new icon tests.
  • Go: go test -race ./... passes.
  • Rust: cargo test --all-targets passes.
  • Python: python -m unittest discover -s tests -t . 40 OK.
  • Typecheck: the library and apps/web typecheck clean. typecheck:demo failed locally only because this worktree's node_modules links to an older built dist without copyMarkdown (Add Markdown copy controls for summary panes #94); CI does a fresh install.

Not done:

  • The Zig port, the C/C++ core and the Ruby/PHP/Perl bindings have no icon API yet.
  • No version bump; that belongs in the release PR.

Related: profullstack/cli-tools#81 (the icon builder), profullstack/logicsrc#198 (the OpenIcon spec).

🤖 Generated with Claude Code

…st glyph

icon(name) returns the Nerd Font glyph, the Unicode symbol or the ASCII
spelling of an OpenIcon icon, whichever this terminal can draw: the app's
setIconMode, then OPENICON_GLYPHS / HQTUI_ICONS, then NERD_FONT=1, then the
existing Unicode detection. A Nerd Font is never assumed. Aliases resolve,
a missing Nerd glyph falls back to Unicode, unknown names draw nothing, and
useIconPack(iconPackFrom(json)) swaps in another set.

370 icons, generated by scripts/generate-icons.ts from
github.com/profullstack/openicon into the TypeScript library and the Go,
Python and Rust ports, each with the same API and tests. Docs section on
hqtui.com/docs#icons and in the README.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio marked this pull request as ready for review September 24, 2026 05:41
@ralyodio
ralyodio added this pull request to stack #97 September 24, 2026 07:18
cpanm --mirror-only resolves from 02packages, which now carries only 2.12,
so the exact @2.11 pin fails with "Found FFI::Platypus 2.12 which doesn't
satisfy == 2.11" on every branch, main included. Makefile.PL and Hqtui.pm
keep 2.11 as the minimum.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 339f14d into main Sep 24, 2026
14 checks passed
ralyodio added a commit that referenced this pull request Sep 24, 2026
The version sites that no build step touches, moved together: the library
and demo package.json, the CLI's VERSION, the demo's --version string, the
site badge, and the workspace ranges in bun.lock.

A minor rather than a patch because the public API grew: icon() and emoji()
landed in #95 and #96, along with `hqtui fonts install`.

The three ^0.6.2 ranges in apps/web, apps/benchmark and examples move too.
A caret below 1.0.0 stops at <0.7.0, so left alone they would declare a
range the library in this tree no longer satisfies.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant