solfaces 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -14
- package/SKILL.md +171 -0
- package/dist/agent/index.cjs +14 -13
- package/dist/agent/index.js +4 -3
- package/dist/agent/mcp-server.cjs +2240 -10
- package/dist/{chunk-TTGJZEPV.js → chunk-77SPWQU5.js} +43 -12
- package/dist/chunk-77SPWQU5.js.map +1 -0
- package/dist/{chunk-JS527VKL.js → chunk-CQWXUU7P.js} +6 -5
- package/dist/chunk-CQWXUU7P.js.map +1 -0
- package/dist/{chunk-46ZEFA6R.cjs → chunk-CXRVPOTI.cjs} +10 -9
- package/dist/chunk-CXRVPOTI.cjs.map +1 -0
- package/dist/{chunk-23XJ5VDX.cjs → chunk-F244Q4KC.cjs} +47 -16
- package/dist/chunk-F244Q4KC.cjs.map +1 -0
- package/dist/{chunk-6UWILY7E.cjs → chunk-HVPGR6G5.cjs} +2 -2
- package/dist/{chunk-6UWILY7E.cjs.map → chunk-HVPGR6G5.cjs.map} +1 -1
- package/dist/{chunk-LRHYF5QN.js → chunk-MGP7F65H.js} +3 -3
- package/dist/{chunk-LRHYF5QN.js.map → chunk-MGP7F65H.js.map} +1 -1
- package/dist/chunk-R3MC2AJZ.cjs +2247 -0
- package/dist/chunk-R3MC2AJZ.cjs.map +1 -0
- package/dist/{chunk-HCEE4K4T.js → chunk-SWML743U.js} +2 -2
- package/dist/{chunk-HCEE4K4T.js.map → chunk-SWML743U.js.map} +1 -1
- package/dist/chunk-SX3FQDKM.js +2238 -0
- package/dist/chunk-SX3FQDKM.js.map +1 -0
- package/dist/{chunk-546TBMAR.cjs → chunk-WTCXTXTV.cjs} +6 -6
- package/dist/{chunk-546TBMAR.cjs.map → chunk-WTCXTXTV.cjs.map} +1 -1
- package/dist/constants-Bi5uTRp5.d.cts +17 -0
- package/dist/constants-Bi5uTRp5.d.ts +17 -0
- package/dist/core/index.cjs +31 -31
- package/dist/core/index.js +3 -3
- package/dist/index.cjs +63 -34
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -4
- package/dist/names/index.cjs +40 -0
- package/dist/names/index.cjs.map +1 -0
- package/dist/names/index.d.cts +36 -0
- package/dist/names/index.d.ts +36 -0
- package/dist/names/index.js +3 -0
- package/dist/names/index.js.map +1 -0
- package/dist/react/index.cjs +45 -22
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +15 -2
- package/dist/react/index.d.ts +15 -2
- package/dist/react/index.js +30 -8
- package/dist/react/index.js.map +1 -1
- package/dist/solfaces.cdn.global.js +2 -2
- package/dist/solfaces.cdn.global.js.map +1 -1
- package/dist/vanilla/index.cjs +5 -5
- package/dist/vanilla/index.js +2 -2
- package/package.json +22 -5
- package/python/solfaces.py +274 -3
- package/reference/integrations.md +166 -0
- package/reference/react.md +108 -0
- package/reference/themes.md +124 -0
- package/dist/chunk-23XJ5VDX.cjs.map +0 -1
- package/dist/chunk-46ZEFA6R.cjs.map +0 -1
- package/dist/chunk-JS527VKL.js.map +0 -1
- package/dist/chunk-TTGJZEPV.js.map +0 -1
- package/skill.md +0 -608
package/skill.md
DELETED
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
# SolFaces — AI Agent Skill
|
|
2
|
-
|
|
3
|
-
You have access to SolFaces, a fully customizable, deterministic avatar generator for Solana wallets. Every wallet address produces a unique, consistent face — same wallet = same face, always. No API calls, no database, no randomness. ~2.56B unique combinations across 11 traits.
|
|
4
|
-
|
|
5
|
-
SolFaces v2 features gradient-rich rendering with skin-luminance-driven color derivation, 10 skin tones, 10 hair styles, 10 accessories, pixel art mode, liquid glass mode, flat mode, and automatic detail levels. Every visual element is fully customizable — 4 color palettes, 8 individual color overrides, 9 per-instance color keys, rendering toggles, layout controls, blink timing, and 30+ React-only pixel/glass fields. No visual element is locked — if you can see it, you can theme it. It eliminates empty avatar slots and generic placeholders — every wallet gets a unique face instantly.
|
|
6
|
-
|
|
7
|
-
Use these tools whenever a user mentions wallet avatars, profile pictures, visual identity, or when you need to represent a Solana wallet visually.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Available Tools
|
|
12
|
-
|
|
13
|
-
### `generate_solface_svg`
|
|
14
|
-
Render an SVG avatar from a wallet address.
|
|
15
|
-
|
|
16
|
-
**When to use:** User wants to see an avatar, embed one in a page, save an image, or display a wallet's face.
|
|
17
|
-
|
|
18
|
-
| Parameter | Type | Required | Default | Description |
|
|
19
|
-
|-----------|------|----------|---------|-------------|
|
|
20
|
-
| `wallet` | string | Yes | — | Solana wallet address (base58) |
|
|
21
|
-
| `size` | number | No | 64 | Width/height in pixels. Sizes >= 48 use full detail (gradients, specular highlights, cheek blush). |
|
|
22
|
-
| `theme` | string | No | — | Preset: default, dark, light, mono, flat, transparent, glass, glassDark, pixel, pixelRetro, pixelClean |
|
|
23
|
-
| `enableBlink` | boolean | No | false | CSS eye-blink animation |
|
|
24
|
-
| `detail` | string | No | auto | Detail level: "full" (gradients, cheeks, specular), "simplified" (flat shapes), "auto" (full if size >= 48) |
|
|
25
|
-
|
|
26
|
-
Returns: SVG string.
|
|
27
|
-
|
|
28
|
-
**Theme notes:**
|
|
29
|
-
- `flat` and `transparent` work in all renderers (string, React, Python).
|
|
30
|
-
- `glass`, `glassDark`, `pixel`, `pixelRetro`, `pixelClean` are **React-only** — they require CSS features (backdrop-filter, image-rendering: pixelated) that only work in a browser with the React component.
|
|
31
|
-
- When using the string renderer, stick to: dark, light, mono, flat, transparent.
|
|
32
|
-
|
|
33
|
-
### `describe_solface`
|
|
34
|
-
Generate a natural language description of a wallet's avatar.
|
|
35
|
-
|
|
36
|
-
**When to use:** User wants alt text, a profile bio, accessibility text, or to know what a face looks like.
|
|
37
|
-
|
|
38
|
-
| Parameter | Type | Required | Default | Description |
|
|
39
|
-
|-----------|------|----------|---------|-------------|
|
|
40
|
-
| `wallet` | string | Yes | — | Solana wallet address |
|
|
41
|
-
| `format` | string | No | paragraph | paragraph, structured, or compact |
|
|
42
|
-
| `perspective` | string | No | third | third or first |
|
|
43
|
-
| `name` | string | No | — | Name to use instead of "This SolFace" |
|
|
44
|
-
|
|
45
|
-
Returns: Description string.
|
|
46
|
-
|
|
47
|
-
### `get_solface_traits`
|
|
48
|
-
Get raw trait data with human-readable labels and a deterministic hash.
|
|
49
|
-
|
|
50
|
-
**When to use:** User wants structured data, wants to compare wallets, or needs the trait hash.
|
|
51
|
-
|
|
52
|
-
| Parameter | Type | Required | Description |
|
|
53
|
-
|-----------|------|----------|-------------|
|
|
54
|
-
| `wallet` | string | Yes | Solana wallet address |
|
|
55
|
-
|
|
56
|
-
Returns: `{ traits, labels, hash }`
|
|
57
|
-
|
|
58
|
-
### `get_agent_identity`
|
|
59
|
-
Generate a system prompt snippet giving an AI agent a visual identity.
|
|
60
|
-
|
|
61
|
-
**When to use:** Setting up an AI agent's persona or bot profile.
|
|
62
|
-
|
|
63
|
-
| Parameter | Type | Required | Description |
|
|
64
|
-
|-----------|------|----------|-------------|
|
|
65
|
-
| `wallet` | string | Yes | Agent's wallet address |
|
|
66
|
-
| `agentName` | string | No | Agent name for personalization |
|
|
67
|
-
|
|
68
|
-
Returns: First-person identity prompt string.
|
|
69
|
-
|
|
70
|
-
### `list_solface_themes`
|
|
71
|
-
List available preset themes with descriptions.
|
|
72
|
-
|
|
73
|
-
**When to use:** User asks what themes exist or you need to recommend one.
|
|
74
|
-
|
|
75
|
-
No parameters. Returns: Array of `{ name, description, reactOnly }`.
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Installation
|
|
80
|
-
|
|
81
|
-
### npm / yarn / pnpm
|
|
82
|
-
```bash
|
|
83
|
-
npm install solfaces
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### CDN (no build step)
|
|
87
|
-
```html
|
|
88
|
-
<script src="https://unpkg.com/solfaces/dist/solfaces.cdn.global.js"></script>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Python (zero dependencies)
|
|
92
|
-
```bash
|
|
93
|
-
curl -O https://raw.githubusercontent.com/jorger3301/solfaces/main/python/solfaces.py
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Import Paths — Choose the Right One
|
|
99
|
-
|
|
100
|
-
| Project Type | Import Path | What You Get |
|
|
101
|
-
|---|---|---|
|
|
102
|
-
| React / Next.js app | `solfaces/react` | `<SolFace>` component with pixel art and glass modes |
|
|
103
|
-
| Vanilla JS / Vue / Svelte | `solfaces/vanilla` | `mountSolFace()`, `setSolFaceImg()`, `autoInit()` |
|
|
104
|
-
| Node.js server / API route | `solfaces` | `renderSolFaceSVG()`, `renderSolFacePNG()`, descriptions, colors |
|
|
105
|
-
| No build step / CDN | `<script>` tag | `window.SolFaces` global |
|
|
106
|
-
| AI agent framework | `solfaces/agent` | Tool schemas + format adapters |
|
|
107
|
-
| Theme presets only | `solfaces/themes` | 11 preset theme objects |
|
|
108
|
-
| Python backend | `from solfaces import ...` | Full Python port |
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## React Integration
|
|
113
|
-
|
|
114
|
-
### Basic usage
|
|
115
|
-
```tsx
|
|
116
|
-
import { SolFace } from "solfaces/react";
|
|
117
|
-
|
|
118
|
-
<SolFace walletAddress="7xKXtg..." size={48} />
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### With theme
|
|
122
|
-
```tsx
|
|
123
|
-
import { SolFace } from "solfaces/react";
|
|
124
|
-
import { darkTheme } from "solfaces/themes";
|
|
125
|
-
|
|
126
|
-
<SolFace walletAddress="7xKXtg..." size={48} theme={darkTheme} />
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### Pixel art mode
|
|
130
|
-
```tsx
|
|
131
|
-
import { SolFace } from "solfaces/react";
|
|
132
|
-
import { pixelTheme, pixelRetroTheme } from "solfaces/themes";
|
|
133
|
-
|
|
134
|
-
<SolFace walletAddress="7xKXtg..." size={64} theme={pixelTheme} />
|
|
135
|
-
<SolFace walletAddress="7xKXtg..." size={64} theme={pixelRetroTheme} />
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Liquid glass mode
|
|
139
|
-
```tsx
|
|
140
|
-
import { SolFace } from "solfaces/react";
|
|
141
|
-
import { glassTheme, glassDarkTheme } from "solfaces/themes";
|
|
142
|
-
|
|
143
|
-
<SolFace walletAddress="7xKXtg..." size={64} theme={glassTheme} />
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Flat mode (no gradients)
|
|
147
|
-
```tsx
|
|
148
|
-
import { SolFace } from "solfaces/react";
|
|
149
|
-
import { flatTheme } from "solfaces/themes";
|
|
150
|
-
|
|
151
|
-
<SolFace walletAddress="7xKXtg..." theme={flatTheme} />
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### With blink animation
|
|
155
|
-
```tsx
|
|
156
|
-
<SolFace walletAddress="7xKXtg..." enableBlink />
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Force detail level
|
|
160
|
-
```tsx
|
|
161
|
-
<SolFace walletAddress="7xKXtg..." size={32} detail="full" /> // Full detail at small size
|
|
162
|
-
<SolFace walletAddress="7xKXtg..." size={128} detail="simplified" /> // Simplified at large size
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### With trait overrides (pin specific traits)
|
|
166
|
-
```tsx
|
|
167
|
-
<SolFace walletAddress="7xKXtg..." traitOverrides={{ hairStyle: 0 }} />
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### With custom styling
|
|
171
|
-
```tsx
|
|
172
|
-
<SolFace
|
|
173
|
-
walletAddress="7xKXtg..."
|
|
174
|
-
size={48}
|
|
175
|
-
className="my-avatar"
|
|
176
|
-
style={{ borderRadius: "50%" }}
|
|
177
|
-
onClick={handleClick}
|
|
178
|
-
/>
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### All props
|
|
182
|
-
```tsx
|
|
183
|
-
interface SolFaceProps {
|
|
184
|
-
walletAddress: string; // Required
|
|
185
|
-
size?: number; // Default: 64
|
|
186
|
-
enableBlink?: boolean | { // Blink animation (boolean or custom timing)
|
|
187
|
-
duration?: number; // Blink cycle in seconds (default: 4)
|
|
188
|
-
delay?: number; // Initial delay in seconds (default: 0)
|
|
189
|
-
};
|
|
190
|
-
theme?: SolFaceTheme; // Optional theme object
|
|
191
|
-
detail?: "full" | "simplified" | "auto"; // Detail level (default: "auto")
|
|
192
|
-
traitOverrides?: Partial<SolFaceTraits>; // Pin specific traits
|
|
193
|
-
colorOverrides?: { // Override individual colors per instance
|
|
194
|
-
skin?: string;
|
|
195
|
-
eyes?: string;
|
|
196
|
-
hair?: string;
|
|
197
|
-
bg?: string;
|
|
198
|
-
mouth?: string;
|
|
199
|
-
eyebrow?: string;
|
|
200
|
-
accessory?: string;
|
|
201
|
-
nose?: string;
|
|
202
|
-
eyeWhite?: string;
|
|
203
|
-
};
|
|
204
|
-
className?: string;
|
|
205
|
-
style?: React.CSSProperties;
|
|
206
|
-
// ...all standard SVG element props (onClick, aria-*, data-*, etc.)
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Custom blink timing
|
|
211
|
-
```tsx
|
|
212
|
-
<SolFace walletAddress="7xKXtg..." enableBlink={{ duration: 3, delay: 1 }} />
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Per-instance color overrides
|
|
216
|
-
|
|
217
|
-
Override any color on a specific avatar without changing the global theme:
|
|
218
|
-
|
|
219
|
-
```tsx
|
|
220
|
-
// React
|
|
221
|
-
<SolFace walletAddress="7xKXtg..." colorOverrides={{ hair: "#ff0000", bg: "#000" }} />
|
|
222
|
-
|
|
223
|
-
// String renderer
|
|
224
|
-
renderSolFaceSVG("7xKXtg...", {
|
|
225
|
-
theme: darkTheme,
|
|
226
|
-
colorOverrides: { skin: "#ffd5b0", eyes: "#00ff00" },
|
|
227
|
-
});
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Available keys: `skin`, `eyes`, `hair`, `bg`, `mouth`, `eyebrow`, `accessory`, `nose`, `eyeWhite`.
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
## Rendering Modes
|
|
235
|
-
|
|
236
|
-
### Detail levels
|
|
237
|
-
- **Full** (default for size >= 48): Gradient fills, specular highlights on eyes, cheek blush, chin shadow, face glow, eyelid strokes, jawline hints.
|
|
238
|
-
- **Simplified** (default for size < 48): Flat shapes, no gradients, no cheeks, no specular — optimized for small sizes.
|
|
239
|
-
- Set explicitly with `detail: "full"` or `detail: "simplified"`.
|
|
240
|
-
|
|
241
|
-
### Flat mode
|
|
242
|
-
Disables all gradients — uses flat fill colors only. Zero `<linearGradient>` or `<radialGradient>` elements.
|
|
243
|
-
```ts
|
|
244
|
-
renderSolFaceSVG(wallet, { theme: { flat: true } });
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Pixel art mode (React only)
|
|
248
|
-
Renders SVG at low pixel density (12-24px) then scales up with `image-rendering: pixelated`. Three variants:
|
|
249
|
-
- `pixel` — 16px density, rounded corners
|
|
250
|
-
- `pixelRetro` — 12px + scanlines + drop shadow
|
|
251
|
-
- `pixelClean` — 24px, clean edges
|
|
252
|
-
|
|
253
|
-
### Liquid glass mode (React only)
|
|
254
|
-
Backdrop-blur glass effect with specular highlights and rim lighting. Two variants:
|
|
255
|
-
- `glass` — Light glass with subtle blur
|
|
256
|
-
- `glassDark` — Dark glass with deeper blur
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## Server-Side / API Routes
|
|
261
|
-
|
|
262
|
-
### Next.js App Router
|
|
263
|
-
```ts
|
|
264
|
-
import { renderSolFaceSVG } from "solfaces";
|
|
265
|
-
|
|
266
|
-
export async function GET(req: Request) {
|
|
267
|
-
const url = new URL(req.url);
|
|
268
|
-
const wallet = url.searchParams.get("wallet");
|
|
269
|
-
const svg = renderSolFaceSVG(wallet, { size: 256 });
|
|
270
|
-
return new Response(svg, {
|
|
271
|
-
headers: { "Content-Type": "image/svg+xml" },
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### PNG for Discord/Telegram (requires `sharp` or `@resvg/resvg-js`)
|
|
277
|
-
```ts
|
|
278
|
-
import { renderSolFacePNG } from "solfaces";
|
|
279
|
-
|
|
280
|
-
const pngBuffer = await renderSolFacePNG("7xKXtg...", { pngSize: 512 });
|
|
281
|
-
|
|
282
|
-
// Save to file
|
|
283
|
-
fs.writeFileSync("avatar.png", pngBuffer);
|
|
284
|
-
|
|
285
|
-
// HTTP response
|
|
286
|
-
return new Response(pngBuffer, {
|
|
287
|
-
headers: { "Content-Type": "image/png" },
|
|
288
|
-
});
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Express
|
|
292
|
-
```ts
|
|
293
|
-
import { renderSolFaceSVG } from "solfaces";
|
|
294
|
-
|
|
295
|
-
app.get("/avatar/:wallet", (req, res) => {
|
|
296
|
-
const svg = renderSolFaceSVG(req.params.wallet, { size: 256 });
|
|
297
|
-
res.type("image/svg+xml").send(svg);
|
|
298
|
-
});
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## Bot Integration
|
|
304
|
-
|
|
305
|
-
### Telegram Bot (grammy)
|
|
306
|
-
```ts
|
|
307
|
-
import { renderSolFacePNG } from "solfaces";
|
|
308
|
-
|
|
309
|
-
bot.command("avatar", async (ctx) => {
|
|
310
|
-
const wallet = ctx.match;
|
|
311
|
-
const png = await renderSolFacePNG(wallet, { pngSize: 256 });
|
|
312
|
-
await ctx.replyWithPhoto(new InputFile(png, "solface.png"));
|
|
313
|
-
});
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Discord Bot (discord.js)
|
|
317
|
-
```ts
|
|
318
|
-
import { renderSolFacePNG } from "solfaces";
|
|
319
|
-
import { AttachmentBuilder } from "discord.js";
|
|
320
|
-
|
|
321
|
-
const png = await renderSolFacePNG(wallet, { pngSize: 256 });
|
|
322
|
-
const attachment = new AttachmentBuilder(png, { name: "solface.png" });
|
|
323
|
-
await interaction.reply({ files: [attachment] });
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
## Custom Themes
|
|
329
|
-
|
|
330
|
-
SolFaces is designed to be fully customizable. Every color, every feature — adapt it to match any brand, any design system.
|
|
331
|
-
|
|
332
|
-
### Use a preset theme
|
|
333
|
-
```ts
|
|
334
|
-
import { renderSolFaceSVG } from "solfaces";
|
|
335
|
-
import { darkTheme } from "solfaces/themes";
|
|
336
|
-
|
|
337
|
-
const svg = renderSolFaceSVG(wallet, { theme: darkTheme });
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### Extend a preset
|
|
341
|
-
```ts
|
|
342
|
-
import { getPresetTheme } from "solfaces/themes";
|
|
343
|
-
|
|
344
|
-
const myTheme = getPresetTheme("dark", {
|
|
345
|
-
bgRadius: 999,
|
|
346
|
-
border: { color: "#14F195", width: 2 },
|
|
347
|
-
});
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### Build a fully custom theme
|
|
351
|
-
|
|
352
|
-
Every visual element is customizable — all fields are optional, only override what you need.
|
|
353
|
-
|
|
354
|
-
```ts
|
|
355
|
-
import type { SolFaceTheme } from "solfaces";
|
|
356
|
-
|
|
357
|
-
const brandTheme: SolFaceTheme = {
|
|
358
|
-
// Color palettes (arrays — one color per trait variant)
|
|
359
|
-
skinColors: ["#fce4d4", "#f5d0b0", "#e8b88a", "#d4956a", "#b5724a", "#8d5524", "#6b3f1d", "#4a2c17", "#3a1f10", "#2a1008"],
|
|
360
|
-
eyeColors: ["#333", "#4a80c4", "#5a9a5a", "#c89430", "#8a8a8a"],
|
|
361
|
-
hairColors: ["#1a1a1a", "#4a3728", "#8b6b4a", "#c44a20", "#d4a844", "#6090e0", "#14F195", "#e040c0", "#ff6b6b", "#4ecdc4"],
|
|
362
|
-
bgColors: ["#14F195", "#4a90e2", "#9945FF", "#f0e68c", "#e06070", "#ff8c42", "#5bc0be", "#8338ec", "#ff006e", "#3a86ff"],
|
|
363
|
-
|
|
364
|
-
// Individual colors
|
|
365
|
-
mouthColor: "#e06070",
|
|
366
|
-
eyebrowColor: "#aaa",
|
|
367
|
-
accessoryColor: "#888",
|
|
368
|
-
eyeWhiteColor: "#e0e0e0", // Sclera + teeth color (set for dark themes)
|
|
369
|
-
noseColor: "#c68642aa", // Nose (defaults to skin-derived)
|
|
370
|
-
glassesColor: "#333",
|
|
371
|
-
earringColor: "#ffd700",
|
|
372
|
-
headbandColor: "#e04080",
|
|
373
|
-
|
|
374
|
-
// Rendering
|
|
375
|
-
flat: false,
|
|
376
|
-
cheekEnabled: true,
|
|
377
|
-
shadowEnabled: true,
|
|
378
|
-
bgOpacity: 1,
|
|
379
|
-
bgRadius: 14,
|
|
380
|
-
border: { color: "#14F195", width: 2 },
|
|
381
|
-
};
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### Theme field reference
|
|
385
|
-
|
|
386
|
-
**Color palettes:**
|
|
387
|
-
|
|
388
|
-
| Field | Type | What it controls |
|
|
389
|
-
|-------|------|-----------------|
|
|
390
|
-
| `skinColors` | `string[]` | 10 skin tone colors |
|
|
391
|
-
| `eyeColors` | `string[]` | 5 iris/pupil colors |
|
|
392
|
-
| `hairColors` | `string[]` | 10 hair fill colors |
|
|
393
|
-
| `bgColors` | `string[]` | 10 background fill colors |
|
|
394
|
-
|
|
395
|
-
**Individual colors:**
|
|
396
|
-
|
|
397
|
-
| Field | Type | What it controls |
|
|
398
|
-
|-------|------|-----------------|
|
|
399
|
-
| `mouthColor` | `string` | Mouth stroke/fill |
|
|
400
|
-
| `eyebrowColor` | `string` | Eyebrow stroke |
|
|
401
|
-
| `accessoryColor` | `string` | Default accessory color (glasses, earring, headband) |
|
|
402
|
-
| `eyeWhiteColor` | `string` | Sclera (eye white) and teeth color — set for dark themes |
|
|
403
|
-
| `noseColor` | `string` | Nose color (defaults to skin-derived + transparency) |
|
|
404
|
-
| `glassesColor` | `string` | Glasses frame color (overrides accessoryColor) |
|
|
405
|
-
| `earringColor` | `string` | Earring color (overrides accessoryColor) |
|
|
406
|
-
| `headbandColor` | `string` | Headband color (overrides accessoryColor) |
|
|
407
|
-
|
|
408
|
-
**Rendering control:**
|
|
409
|
-
|
|
410
|
-
| Field | Type | What it controls |
|
|
411
|
-
|-------|------|-----------------|
|
|
412
|
-
| `flat` | `boolean` | Disable all gradients |
|
|
413
|
-
| `cheekEnabled` | `boolean` | Enable/disable cheek blush |
|
|
414
|
-
| `cheekColor` | `string` | Custom cheek color |
|
|
415
|
-
| `cheekOpacity` | `number` | Cheek blush opacity (0-1) |
|
|
416
|
-
| `skinOpacity` | `number` | Skin fill opacity (0-1) |
|
|
417
|
-
| `shadowEnabled` | `boolean` | Enable/disable chin shadow and face overlays |
|
|
418
|
-
|
|
419
|
-
**Layout:**
|
|
420
|
-
|
|
421
|
-
| Field | Type | What it controls |
|
|
422
|
-
|-------|------|-----------------|
|
|
423
|
-
| `bgOpacity` | `number` | Background opacity (0-1) |
|
|
424
|
-
| `bgRadius` | `number` | SVG rect border radius (999 = circle) |
|
|
425
|
-
| `border` | `{ color, width }` | Optional border around avatar |
|
|
426
|
-
|
|
427
|
-
### Pixel art customization (React only)
|
|
428
|
-
|
|
429
|
-
Set `_pixel: true` to enable. Key fields: `_pixelDensity` (render resolution, default 16), `_pixelRounded`, `_pixelOutline`, `_pixelOutlineColor`, `_pixelOutlineWidth`, `_pixelContrast`, `_pixelSaturation`, `_pixelBrightness`, `_pixelScanlines`, `_pixelScanlineOpacity`, `_pixelScanlineSpacing`, `_pixelGrid`, `_pixelGridOpacity`, `_pixelGridColor`, `_pixelShadow`, `_pixelShadowColor`, `_pixelShadowOffset`.
|
|
430
|
-
|
|
431
|
-
### Liquid glass customization (React only)
|
|
432
|
-
|
|
433
|
-
Set `_glass: true` to enable. Key fields: `_blurRadius` (default 12), `_saturate`, `_tintColor`, `_tintOpacity`, `_borderColor`, `_borderWidth`, `_borderOpacity`, `_specularColor`, `_specularOpacity`, `_specularEnd`, `_lightAngle`, `_rimIntensity`, `_shadow`.
|
|
434
|
-
|
|
435
|
-
### Theme recommendations by context
|
|
436
|
-
|
|
437
|
-
| Context | Theme | Why |
|
|
438
|
-
|---------|-------|-----|
|
|
439
|
-
| Default / no preference | `default` | Base gradient-rich look, no overrides |
|
|
440
|
-
| Dark UI / dark mode | `dark` | Dark backgrounds, muted tones, subtle border |
|
|
441
|
-
| Light UI / white background | `light` | Soft pastel backgrounds |
|
|
442
|
-
| Minimal / clean | `mono` | Full grayscale |
|
|
443
|
-
| No gradients / print / email | `flat` | Flat fill colors only |
|
|
444
|
-
| Transparent overlay | `transparent` | Transparent BG, flat rendering |
|
|
445
|
-
| Modern glass UI (React) | `glass` | Backdrop blur, specular highlights |
|
|
446
|
-
| Dark glass UI (React) | `glassDark` | Dark glass with deeper blur |
|
|
447
|
-
| Retro / gaming (React) | `pixel` or `pixelRetro` | Pixelated rendering, optional scanlines |
|
|
448
|
-
| Clean pixel art (React) | `pixelClean` | Higher density pixel art |
|
|
449
|
-
|
|
450
|
-
---
|
|
451
|
-
|
|
452
|
-
## Agent Framework Integration
|
|
453
|
-
|
|
454
|
-
### OpenAI Function Calling
|
|
455
|
-
```ts
|
|
456
|
-
import { allToolsOpenAI, handleToolCall } from "solfaces/agent";
|
|
457
|
-
|
|
458
|
-
const response = await openai.chat.completions.create({
|
|
459
|
-
model: "gpt-4",
|
|
460
|
-
messages,
|
|
461
|
-
tools: allToolsOpenAI(),
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
for (const call of response.choices[0].message.tool_calls) {
|
|
465
|
-
const result = await handleToolCall(call.function.name, JSON.parse(call.function.arguments));
|
|
466
|
-
}
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
### Claude / Anthropic Tool Use
|
|
470
|
-
```ts
|
|
471
|
-
import { allToolsAnthropic, handleToolCall } from "solfaces/agent";
|
|
472
|
-
|
|
473
|
-
const response = await anthropic.messages.create({
|
|
474
|
-
model: "claude-sonnet-4-20250514",
|
|
475
|
-
messages,
|
|
476
|
-
tools: allToolsAnthropic(),
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
for (const block of response.content) {
|
|
480
|
-
if (block.type === "tool_use") {
|
|
481
|
-
const result = await handleToolCall(block.name, block.input);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
### Vercel AI SDK
|
|
487
|
-
```ts
|
|
488
|
-
import { allToolsVercelAI } from "solfaces/agent";
|
|
489
|
-
import { generateText } from "ai";
|
|
490
|
-
|
|
491
|
-
const { text } = await generateText({
|
|
492
|
-
model: yourModel,
|
|
493
|
-
prompt: "Show me the avatar for wallet 7xKXtg...",
|
|
494
|
-
tools: allToolsVercelAI(),
|
|
495
|
-
});
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
### MCP Server (Claude Code / Cursor)
|
|
499
|
-
Add to your MCP config (`~/.claude/settings.json` or `.cursor/mcp.json`):
|
|
500
|
-
```json
|
|
501
|
-
{
|
|
502
|
-
"mcpServers": {
|
|
503
|
-
"solfaces": {
|
|
504
|
-
"command": "npx",
|
|
505
|
-
"args": ["-y", "solfaces"]
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
### Universal dispatcher (any framework)
|
|
512
|
-
```ts
|
|
513
|
-
import { handleToolCall } from "solfaces/agent";
|
|
514
|
-
|
|
515
|
-
const svg = await handleToolCall("generate_solface_svg", {
|
|
516
|
-
wallet: "7xKXtg...",
|
|
517
|
-
theme: "dark",
|
|
518
|
-
size: 128,
|
|
519
|
-
});
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
---
|
|
523
|
-
|
|
524
|
-
## Color Math Utilities
|
|
525
|
-
|
|
526
|
-
SolFaces exports its color math functions for advanced use cases:
|
|
527
|
-
|
|
528
|
-
```ts
|
|
529
|
-
import { hexToRgb, rgbToHex, darken, lighten, blend, luminance, deriveSkinColors } from "solfaces";
|
|
530
|
-
|
|
531
|
-
const [r, g, b] = hexToRgb("#ff6b6b");
|
|
532
|
-
const darker = darken("#ff6b6b", 0.2);
|
|
533
|
-
const lighter = lighten("#ff6b6b", 0.2);
|
|
534
|
-
const mixed = blend("#ff0000", "#0000ff", 0.5);
|
|
535
|
-
const lum = luminance("#ff6b6b"); // 0-255
|
|
536
|
-
|
|
537
|
-
// Full skin-luminance derivation (used internally by renderers)
|
|
538
|
-
const colors = deriveSkinColors("#e8b88a");
|
|
539
|
-
// → { skinHi, skinLo, skinMid, isDark, cheekColor, cheekOpacity, lipColor, noseFill, browColor, earFill, earShadow, eyeWhiteAdapted, lidColor, accessoryColor }
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
---
|
|
543
|
-
|
|
544
|
-
## Accessibility
|
|
545
|
-
|
|
546
|
-
Always provide alt text for SolFace avatars:
|
|
547
|
-
|
|
548
|
-
```ts
|
|
549
|
-
import { solFaceAltText } from "solfaces";
|
|
550
|
-
|
|
551
|
-
const alt = solFaceAltText("7xKXtg...");
|
|
552
|
-
// → "SolFace avatar: squircle face, warm golden skin, hazel almond eyes, ..."
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
Or use the `describe_solface` tool with `format: "compact"` for the same result.
|
|
556
|
-
|
|
557
|
-
In React:
|
|
558
|
-
```tsx
|
|
559
|
-
<img src={dataUri} alt={solFaceAltText(wallet)} />
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
---
|
|
563
|
-
|
|
564
|
-
## API Reference
|
|
565
|
-
|
|
566
|
-
| Function | Import | Returns | Description |
|
|
567
|
-
|----------|--------|---------|-------------|
|
|
568
|
-
| `generateTraits(wallet, overrides?)` | `solfaces` | `SolFaceTraits` | Deterministic traits from wallet |
|
|
569
|
-
| `getTraitLabels(traits)` | `solfaces` | `Record<string, string>` | Human-readable trait names |
|
|
570
|
-
| `traitHash(wallet)` | `solfaces` | `string` | 8-char hex hash |
|
|
571
|
-
| `resolveTheme(name?, themes?)` | `solfaces` | `SolFaceTheme \| undefined` | Look up theme by name from a map |
|
|
572
|
-
| `mergeTheme(base, overrides)` | `solfaces` | `SolFaceTheme` | Merge two themes |
|
|
573
|
-
| `effectiveAccessory(traits)` | `solfaces` | `number` | Accessory index with earring suppression |
|
|
574
|
-
| `renderSolFaceSVG(wallet, options?)` | `solfaces` | `string` | Raw SVG markup |
|
|
575
|
-
| `renderSolFaceDataURI(wallet, options?)` | `solfaces` | `string` | Data URI for `<img>` tags |
|
|
576
|
-
| `renderSolFaceBase64(wallet, options?)` | `solfaces` | `string` | Base64 data URI |
|
|
577
|
-
| `renderSolFacePNG(wallet, options?)` | `solfaces` | `Promise<Buffer>` | PNG buffer (Node, needs sharp/resvg) |
|
|
578
|
-
| `renderSolFacePNGBrowser(wallet, options?)` | `solfaces` | `Promise<Blob>` | PNG blob (browser) |
|
|
579
|
-
| `renderSolFacePNGDataURL(wallet, options?)` | `solfaces` | `Promise<string>` | PNG data URL (browser) |
|
|
580
|
-
| `describeAppearance(wallet, options?)` | `solfaces` | `string` | Natural language description |
|
|
581
|
-
| `describeTraits(traits, options?)` | `solfaces` | `string` | Describe from pre-generated traits |
|
|
582
|
-
| `agentAppearancePrompt(wallet, name?)` | `solfaces` | `string` | System prompt for AI agents |
|
|
583
|
-
| `solFaceAltText(wallet)` | `solfaces` | `string` | Accessible alt text |
|
|
584
|
-
| `deriveSkinColors(skinHex)` | `solfaces` | `DerivedColors` | Skin-luminance color derivation |
|
|
585
|
-
| `getPresetTheme(name, overrides?)` | `solfaces/themes` | `SolFaceTheme` | Get/extend a preset theme |
|
|
586
|
-
| `SOLFACE_TOOLS` | `solfaces/agent` | `SolFaceTool[]` | All 5 tool definitions |
|
|
587
|
-
| `handleToolCall(name, params)` | `solfaces/agent` | `unknown` | Universal tool dispatcher |
|
|
588
|
-
| `allToolsOpenAI()` | `solfaces/agent` | `OpenAITool[]` | Tools in OpenAI format |
|
|
589
|
-
| `allToolsAnthropic()` | `solfaces/agent` | `AnthropicTool[]` | Tools in Anthropic format |
|
|
590
|
-
| `allToolsVercelAI()` | `solfaces/agent` | `Record<string, VercelAITool>` | Tools in Vercel AI format |
|
|
591
|
-
| `allToolsMCP()` | `solfaces/agent` | `MCPTool[]` | Tools in MCP format |
|
|
592
|
-
|
|
593
|
-
---
|
|
594
|
-
|
|
595
|
-
## Key Facts
|
|
596
|
-
|
|
597
|
-
- **Deterministic**: Same wallet = same face, always. Guaranteed by djb2 hash + mulberry32 PRNG.
|
|
598
|
-
- **11 traits**: Face shape (4), skin (10), eye style (8), eye color (5), eyebrows (5), nose (4), mouth (8), hair style (10), hair color (10), accessory (10), background (10) = ~2.56B unique combinations.
|
|
599
|
-
- **Gradient-rich rendering**: Skin-luminance-driven color derivation produces cohesive faces — highlights, shadows, cheeks, lips, ears, and eye whites all adapt automatically.
|
|
600
|
-
- **Detail levels**: Full (gradients, specular, cheeks) at size >= 48; simplified (flat shapes) below. Override with `detail` option.
|
|
601
|
-
- **Flat mode**: Set `theme: { flat: true }` to disable all gradients.
|
|
602
|
-
- **Pixel art** (React only): `pixelTheme`, `pixelRetroTheme`, `pixelCleanTheme` — renders at low density then scales with pixelated rendering.
|
|
603
|
-
- **Liquid glass** (React only): `glassTheme`, `glassDarkTheme` — backdrop-filter blur with specular highlights and rim lighting.
|
|
604
|
-
- **Earring suppression**: Long and bob hairstyles automatically suppress earring accessories.
|
|
605
|
-
- **Cross-language parity**: JavaScript and Python produce identical SVG output (same colors, same gradients).
|
|
606
|
-
- **Zero dependencies**: Core engine has no runtime deps.
|
|
607
|
-
- **Sub-millisecond**: Trait generation and SVG rendering are nearly instant.
|
|
608
|
-
- **SVG viewBox**: All avatars use a 64x64 viewBox, scaled by the `size` parameter.
|