{"_id":"hashvatar","_rev":"3-92dc8d6abb95949db31c721392037db9","name":"hashvatar","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"hashvatar","version":"0.1.0","keywords":["avatar","identicon","jazzicon","web3","wallet","deterministic","gradient","dither","halftone"],"author":{"name":"Médhy"},"license":"MIT","_id":"hashvatar@0.1.0","maintainers":[{"name":"medhy","email":"hello@medhy.fr"}],"homepage":"https://github.com/medhychabour/hashvatar#readme","bugs":{"url":"https://github.com/medhychabour/hashvatar/issues"},"dist":{"shasum":"e00f6b3524554b1f068ef7e58599f828a9746ec4","tarball":"https://registry.npmjs.org/hashvatar/-/hashvatar-0.1.0.tgz","fileCount":11,"integrity":"sha512-fO8Ci0wM0GqBIU3SPxGQqb65bKfZRe2uGIOR+/rM6MTZ092/Gicvcjev9tuz9OlIIzMgqISybF9P38pKZHdujg==","signatures":[{"sig":"MEUCIQC3B1wXsSJfLY5xWWiqH3mDJq9FeuNgntmozOUo3u3OawIgCUkCoUKmOE+C9r5wwLQglqt3CQ2NkeQO2dIIjq/ClGI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43438},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","require":"./dist/react.cjs"}},"gitHead":"a2eab6b4c197d4ba554fea2681d277cd7f8117f7","scripts":{"dev":"tsup --watch","demo":"npx serve . -p 5000","build":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"medhy","email":"hello@medhy.fr"},"repository":{"url":"git+https://github.com/medhychabour/hashvatar.git","type":"git"},"_npmVersion":"11.6.2","description":"Deterministic avatar generation from any hash string. Zero dependencies.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","typescript":"^5.0.0","@types/react":"^18.0.0"},"peerDependencies":{"react":">=17"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/hashvatar_0.1.0_1772151209664_0.600162313970005","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"hashvatar","version":"0.1.1","keywords":["avatar","identicon","jazzicon","web3","wallet","deterministic","gradient","dither","halftone"],"author":{"name":"Médhy"},"license":"MIT","_id":"hashvatar@0.1.1","maintainers":[{"name":"medhy","email":"hello@medhy.fr"}],"homepage":"https://github.com/medhychabour/hashvatar#readme","bugs":{"url":"https://github.com/medhychabour/hashvatar/issues"},"dist":{"shasum":"2eedfad4b6e00bc41b6dff2df712125dbdf25afc","tarball":"https://registry.npmjs.org/hashvatar/-/hashvatar-0.1.1.tgz","fileCount":11,"integrity":"sha512-W1IUE5r8Y8BMXtTGxrhEg2Ri612CxsSFuJsYInX1btmPnWXZi+GBIp8ul5x6rli8qdIRYCJwVHVxzBd8KfFyYA==","signatures":[{"sig":"MEUCIQDH8gcRhhdLyGMdEPJoAyxjJvYxdTtXlLhgdhESeEztYgIgbtVch5unn8xeorqqHY5P1aMTqR4hHg40D7InRfIIYlM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50800},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","require":"./dist/react.cjs"}},"gitHead":"a2eab6b4c197d4ba554fea2681d277cd7f8117f7","scripts":{"dev":"tsup --watch","demo":"npx serve . -l tcp://0.0.0.0:5000","build":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"medhy","email":"hello@medhy.fr"},"repository":{"url":"git+https://github.com/medhychabour/hashvatar.git","type":"git"},"_npmVersion":"11.6.2","description":"Deterministic avatar generation from any hash string. Zero dependencies.","directories":{},"sideEffects":false,"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","typescript":"^5.0.0","@types/react":"^18.0.0"},"peerDependencies":{"react":">=17"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/hashvatar_0.1.1_1772215356705_0.16479569023496077","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"hashvatar","version":"0.1.2","description":"Deterministic avatar generation from any hash string. Zero dependencies.","author":{"name":"Médhy"},"license":"MIT","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","require":"./dist/react.cjs"}},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","demo":"npx serve . -l tcp://0.0.0.0:5000","prepublishOnly":"npm run build"},"devDependencies":{"@types/react":"^18.0.0","react":"^18.0.0","tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":">=17"},"peerDependenciesMeta":{"react":{"optional":true}},"keywords":["avatar","identicon","jazzicon","web3","wallet","deterministic","gradient","dither","halftone"],"repository":{"type":"git","url":"git+https://github.com/medhychabour/hashvatar.git"},"gitHead":"a280479f0d07ce0b912fed51ac106b8f8aade635","_id":"hashvatar@0.1.2","bugs":{"url":"https://github.com/medhychabour/hashvatar/issues"},"homepage":"https://github.com/medhychabour/hashvatar#readme","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-RdGvT8Ct0qTzDwAFkJACurTiCJ+Pv7YBwvq4YCKX6ZPNFvOPsb9nCc7Leh3jgxZCgutnCjaWEkYm7p4lVQaq1g==","shasum":"886a9d64c7ba33c5557f56aeecab2124d6194ff7","tarball":"https://registry.npmjs.org/hashvatar/-/hashvatar-0.1.2.tgz","fileCount":11,"unpackedSize":50800,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHMl1fPo7Pr7LLEQeh/IuYz2STaMuIC+pKSoh00sNaTGAiEA5vjAhj19TEOHIFLCn+UUzPTYYDWvWSlSfpxj91J8Gug="}]},"_npmUser":{"name":"medhy","email":"hello@medhy.fr"},"directories":{},"maintainers":[{"name":"medhy","email":"hello@medhy.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hashvatar_0.1.2_1772235072154_0.8083894277366437"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-27T00:13:29.585Z","modified":"2026-02-27T23:31:12.407Z","0.1.0":"2026-02-27T00:13:29.836Z","0.1.1":"2026-02-27T18:02:36.887Z","0.1.2":"2026-02-27T23:31:12.289Z"},"bugs":{"url":"https://github.com/medhychabour/hashvatar/issues"},"author":{"name":"Médhy"},"license":"MIT","homepage":"https://github.com/medhychabour/hashvatar#readme","keywords":["avatar","identicon","jazzicon","web3","wallet","deterministic","gradient","dither","halftone"],"repository":{"type":"git","url":"git+https://github.com/medhychabour/hashvatar.git"},"description":"Deterministic avatar generation from any hash string. Zero dependencies.","maintainers":[{"name":"medhy","email":"hello@medhy.fr"}],"readme":"# hashvatar\n\nDeterministic avatars from any string — wallet address, username, UUID. **Zero dependencies**.\n\nTwo modes: **gradient** (radial blends) and **dither** (Bayer halftone + linear gradient).\n\n```bash\nnpm install hashvatar\n```\n\n---\n\n## Demo\n\nFrom the repo root, build then run the demo:\n\n```bash\nnpm run build\nnpm run demo\n```\n\nThen open **http://localhost:5000/demo/** in your browser. The demo loads the built bundle from `dist/`.\n\n---\n\n## Usage\n\n### Vanilla JS\n\n```js\nimport { createHashvatar } from \"hashvatar\";\n\nconst { canvas, destroy } = createHashvatar({\n\thash: \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n\tsize: 64,\n});\n\ndocument.body.appendChild(canvas);\n\n// Stop animation later if animated:\ndestroy();\n```\n\n### React\n\n```tsx\nimport { Hashvatar } from 'hashvatar/react';\n\n<Hashvatar hash=\"vitalik.eth\" size={48} />\n<Hashvatar hash=\"satoshi\" size={64} mode=\"dither\" />\n<Hashvatar hash=\"0x742…44e\" size={64} animated tones={['hotpink', '#00ff99']} />\n```\n\nReact is an optional peer dependency — only install it if you use `hashvatar/react`.\n\n---\n\n## Options\n\n| Option     | Type                     | Default      | Description                                                           |\n| ---------- | ------------------------ | ------------ | --------------------------------------------------------------------- |\n| `hash`     | `string`                 | —            | Any string. Same string = same avatar.                                |\n| `size`     | `number`                 | `64`         | Canvas size in px (square).                                           |\n| `mode`     | `'gradient' \\| 'dither'` | `'gradient'` | Render style.                                                         |\n| `animated` | `boolean`                | `false`      | Animation loop.                                                       |\n| `dotScale` | `number`                 | —            | Dither cell size. If omitted, scales with canvas for consistent look. |\n| `tones`    | `string[]`               | —            | Restrict palette (hex, `oklch()`, CSS color names).                   |\n\n**`createHashvatar(options)`** — returns `{ canvas, colors, destroy }`.\n\n**`renderHashvatar(canvas, options)`** — draws into an existing canvas; returns `destroy()`.\n\n**`hashToColors(hash, tones?, count?)`** — returns the generated OKLCH colors without rendering.\n\n**`hashToSeeds(hash, count)`** — returns `count` deterministic numbers in `[0, 1)` from the hash (for custom rendering or seeding).\n\n---\n\n## Circle / clipping\n\nThe canvas is **square**. To show a circle:\n\n```css\ncanvas {\n\tborder-radius: 50%;\n}\n```\n\nThe React component already uses `border-radius: 50%` by default. You can also use a rounded square, hexagon via `clip-path`, etc.\n\n---\n\n## Tone constraints\n\n```js\n// Single hue family\ncreateHashvatar({ hash, tones: [\"hotpink\"] });\n\n// Multiple\ncreateHashvatar({ hash, tones: [\"#ff6b6b\", \"#4ecdc4\"] });\n\n// oklch\ncreateHashvatar({ hash, tones: [\"oklch(0.65 0.25 310)\"] });\n```\n\n---\n\n## Development\n\n```bash\nnpm install\nnpm run build    # ESM + CJS + types (tsup)\nnpm run dev      # watch & rebuild\nnpm run demo     # serve on port 5000\n```\n\n---\n\n## Publish\n\n```bash\nnpm run build\nnpm publish\n```\n\n---\n\nMIT — [Médhy](https://github.com/medhychabour) · [repo](https://github.com/medhychabour/hashvatar)\n","readmeFilename":"README.md"}