@urbit-xyz/azimuth-hanzi
v0.1.0
Published
Chinese character mapping and SVG generation for Urbit Azimuth identities
Maintainers
Readme
azimuth-hanzi
Chinese-character sigils for Urbit Azimuth identities. Maps the 512 Urbit syllables (256 prefixes + 256 suffixes) to Hanzi characters and renders them as SVG.
Status: the mapping is a work in progress. This repository is open so the character assignments can be refined collaboratively before they are finalized. See DESIGN.md for the ruleset and open items.
Install
npm install @urbit-xyz/azimuth-hanziUse
import { hanziSigil, parsePoint } from '@urbit-xyz/azimuth-hanzi'
const svg = hanziSigil({
point: '~sampel-palnet',
size: 128,
background: '#000',
foreground: '#fff',
space: 'default', // 'none' | 'default' | 'large'
})
const parsed = parsePoint('~sampel-palnet')
// { phonemes: ['sam', 'pel', 'pal', 'net'], characters: ['森', '培', ...], type: 'planet' }Layout by point type:
| Ship type | Characters | Layout | | --------- | ---------- | ------------ | | Galaxy | 1 | Centered | | Star | 2 | Side-by-side | | Planet | 4 | 2×2 grid | | Moon | 8 | 2×4 grid |
For repeated renders of the same configuration, use memoizedHanziSigil (same signature, cached by config).
Web components
Auto-registered on module load:
<urbit-hanzi point="~sampel-palnet" size="128" background="#000" foreground="#fff"></urbit-hanzi>
<urbit-hanzi-image point="~sampel-palnet" size="128"></urbit-hanzi-image>Inspecting the mapping
import { PREFIXES, PREFIX_GROUPS, getCharacter } from '@urbit-xyz/azimuth-hanzi'
PREFIXES[0] // 'doz' — Urbit syllable for byte 0
getCharacter('doz') // '红' — assigned Hanzi
PREFIX_GROUPS['Colors & Light'] // { 0: ['红', 'hóng', 'red'], 1: ['青', 'qīng', 'azure'], ... }SUFFIXES, SUFFIX_GROUPS, PREFIX_CHARACTERS (flat map with category attached), PHONEME_INDEX, isPrefix, and isSuffix are also exported.
Develop
git clone https://github.com/master-malwyl/azimuth-hanzi
cd azimuth-hanzi
npm install
npm run build # emits ./dist
npm test
npm run preview # serves http://localhost:8080/preview.htmlpreview.html is a single-file catalogue viewer: every prefix and suffix side-by-side with pinyin and gloss, plus a generator that renders any Urbit ID.
Contributing
Read DESIGN.md first — it explains the goal, the ruleset that guides character choices, and the open items a refinement pass should tackle.
The canonical 512-character mapping lives in src/mapping.ts, keyed by byte (0–255) and grouped by theme:
export const PREFIX_GROUPS = {
'Colors & Light': { // bytes 0-21 (doz..lid)
0: ['红', 'hóng', 'red'],
1: ['青', 'qīng', 'azure'],
// ...
},
// ...
}To change an assignment, edit the [character, pinyin, gloss] tuple in place. The group key is the category; moving an entry to a different category means moving the line to a different group (and updating the byte-range comment on both groups).
Open a PR explaining which rule from DESIGN.md the change advances.
License
MIT. See LICENSE.
