← All tools

kud/glyphs

Popularity 75 Updated Network & Systems

Multi-language source of truth for terminal glyphs — Nerd Font codepoints and unicode fallbacks, typed and escape-safe

githubauto-collected

Installation

A directly usable install command is not verified yet. Check the project documentation or releases.

<div align="center"

Multi-language source of truth for terminal glyphs — Nerd Font codepoints and unicode fallbacks, typed and escape-safe

<a href="https://kud.io/projects/glyphs"Website</a · <a href="https://kud.io/projects/glyphs/docs"Documentation</a

</div

Features

  • One source, many outputs — a single glyphs.json (name → { nerd, unicode?, emoji? }) generates every language binding, so no project hand-maps codepoints again.
  • Escapes by construction — codepoints are always emitted as normalised escapes (\u{XXXX} in TypeScript, $'\U0000XXXX' in zsh), never as raw Private-Use-Area bytes that are invisible in editors and mangle in diffs.
  • Typed TypeScript API — a glyphs record, a glyph(name, variant?) lookup with a GlyphName union that rejects typos at compile time, and a Variant type ("nerd" | "unicode" | "emoji").
  • Consumer-agnostic zsh rendering — renderZsh({ prefix, variant, names }) emits $prefixNAME=... assignments under whatever namespace the caller wants. The library names no specific consumer.
  • Multi-scalar emoji handled correctly — emoji values are literal strings that may be grapheme clusters (⚠️ = U+26A0 U+FE0F), stored and escaped as a sequence rather than a single codepoint.

Install

npm install @kud/glyphs

Usage

TypeScript

import { glyphs, glyph, renderZsh } from "@kud/glyphs"

glyphs.check.nerd // ""
glyph("check") // "" — defaults to the nerd variant
glyph("check", "emoji") // "✅"
glyph("plArrowRight", "unicode") // "" — absent variants resolve to ""

zsh — via the published plugin

Load the repo as a plugin — no npm involved. glyphs.plugin.zsh sources ICON variables (nerd variant) directly:

# antidote — add to ~/.zsh_plugins.txt
kud/glyphs

# zinit
zinit light kud/glyphs

# oh-my-zsh — clone into $ZSH_CUSTOM/plugins/glyphs, then add `glyphs` to plugins=()
print -P "$ICON_CHECK done"
echo "$ICON_ARROW_RIGHT next"

zsh — custom prefix (no node)

Want your own namespace instead of ICON? Each variant is published as a plain, escape-safe zsh file under zsh/. Substitute the prefix with sed — no node, no runtime dependency, values untouched (the swap is anchored to the variable name, never the $'\U…' payload):

# nerd glyphs under a SHUI_ICON_ prefix
curl -fsSL https://raw.githubusercontent.com/kud/glyphs/v0.3.0/zsh/nerd.zsh \
  | sed 's/^ICON_/SHUI_ICON_/' > icons.zsh

source icons.zsh
# icons.zsh contains:
#   SHUI_ICON_CHECK=$'\U0000F00C'
#   SHUI_ICON_CROSS=$'\U0000F00D'