termlings 0.1.1 → 0.1.3
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 +92 -19
- package/bin/termlings.js +947 -0
- package/package.json +12 -6
- package/src/cli.ts +378 -0
- package/src/index.ts +46 -29
- package/src/ink/Avatar.tsx +4 -7
- package/src/react/Avatar.tsx +3 -2
- package/src/svelte/Avatar.svelte +3 -2
- package/src/vue/Avatar.vue +3 -1
package/README.md
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="banner.png" alt="termlings — Open-source pixel creatures for web and the terminal" width="800" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# termlings
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
Open-source pixel creatures for web and the terminal.
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="demo.gif" alt="Animated termlings walking, talking, and waving" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
Each avatar is encoded as a **7-character hex DNA string** (~32M combinations) that deterministically renders a unique character with hat, eyes, mouth, body, legs, and two independent color hues.
|
|
14
|
+
|
|
15
|
+
## CLI
|
|
16
|
+
|
|
17
|
+
No install required — just use `npx`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Render a DNA
|
|
21
|
+
npx termlings 0a3f201
|
|
22
|
+
|
|
23
|
+
# Render by name (deterministic)
|
|
24
|
+
npx termlings my-agent
|
|
25
|
+
|
|
26
|
+
# Random termling
|
|
27
|
+
npx termlings
|
|
28
|
+
|
|
29
|
+
# Animated (Ctrl+C to stop)
|
|
30
|
+
npx termlings 0a3f201 --walk
|
|
31
|
+
npx termlings 0a3f201 --talk --wave
|
|
32
|
+
|
|
33
|
+
# Compact half-height mode
|
|
34
|
+
npx termlings 0a3f201 --compact
|
|
35
|
+
|
|
36
|
+
# Output SVG to stdout
|
|
37
|
+
npx termlings 0a3f201 --svg > avatar.svg
|
|
38
|
+
|
|
39
|
+
# SVG options
|
|
40
|
+
npx termlings 0a3f201 --svg --size=20 --bg=#000 --padding=2
|
|
41
|
+
|
|
42
|
+
# Animated SVG with CSS keyframes
|
|
43
|
+
npx termlings 0a3f201 --svg --animated --walk --talk
|
|
44
|
+
```
|
|
4
45
|
|
|
5
46
|
## Install
|
|
6
47
|
|
|
@@ -100,7 +141,52 @@ const grid = generateGrid(traits, walkFrame, talkFrame, waveFrame);
|
|
|
100
141
|
<Avatar dna="0a3f201" waving />
|
|
101
142
|
```
|
|
102
143
|
|
|
103
|
-
|
|
144
|
+
### React
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
import { Avatar } from 'termlings/react';
|
|
148
|
+
|
|
149
|
+
function App() {
|
|
150
|
+
return (
|
|
151
|
+
<>
|
|
152
|
+
<Avatar dna="0a3f201" />
|
|
153
|
+
<Avatar name="my-agent" size="xl" />
|
|
154
|
+
<Avatar dna="0a3f201" walking />
|
|
155
|
+
<Avatar dna="0a3f201" talking />
|
|
156
|
+
<Avatar dna="0a3f201" waving />
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Vue
|
|
163
|
+
|
|
164
|
+
```vue
|
|
165
|
+
<script setup>
|
|
166
|
+
import { Avatar } from 'termlings/vue';
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<template>
|
|
170
|
+
<Avatar dna="0a3f201" />
|
|
171
|
+
<Avatar name="my-agent" size="xl" />
|
|
172
|
+
<Avatar dna="0a3f201" walking />
|
|
173
|
+
<Avatar dna="0a3f201" talking />
|
|
174
|
+
<Avatar dna="0a3f201" waving />
|
|
175
|
+
</template>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Ink (terminal React)
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { render } from 'ink';
|
|
182
|
+
import { Avatar } from 'termlings/ink';
|
|
183
|
+
|
|
184
|
+
render(<Avatar dna="0a3f201" />);
|
|
185
|
+
render(<Avatar dna="0a3f201" compact />);
|
|
186
|
+
render(<Avatar dna="0a3f201" walking />);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Props
|
|
104
190
|
|
|
105
191
|
| Prop | Type | Default | Description |
|
|
106
192
|
|------|------|---------|-------------|
|
|
@@ -151,27 +237,14 @@ The avatar is a 9-column grid with variable height (depends on hat). Each cell i
|
|
|
151
237
|
| `a` | Arm | Half-height face color |
|
|
152
238
|
| `_` | Transparent | Empty |
|
|
153
239
|
|
|
154
|
-
## Colors
|
|
155
|
-
|
|
156
|
-
Each avatar has 3 colors derived from two hue indices (0-11, mapped to 0-330 degrees):
|
|
157
|
-
|
|
158
|
-
- **Face color**: `hsl(faceHue * 30, 50%, 50%)`
|
|
159
|
-
- **Dark color**: `hsl(faceHue * 30, 50%, 28%)` — eyes, mouth
|
|
160
|
-
- **Hat color**: `hsl(hatHue * 30, 50%, 50%)`
|
|
161
|
-
|
|
162
|
-
## Animations
|
|
163
|
-
|
|
164
|
-
The grid generator supports three animation types via frame parameters:
|
|
165
|
-
|
|
166
|
-
- **Walking** (`frame`): Cycles through leg variant frames
|
|
167
|
-
- **Talking** (`talkFrame`): 0 = normal mouth, 1+ = open mouth animation
|
|
168
|
-
- **Waving** (`waveFrame`): 0 = normal body, 1+ = alternating arm positions
|
|
169
|
-
|
|
170
240
|
## Exports
|
|
171
241
|
|
|
172
242
|
```
|
|
173
243
|
termlings — Core TypeScript (DNA, grid, SVG, terminal, colors)
|
|
174
|
-
termlings/svelte — Svelte 5 component
|
|
244
|
+
termlings/svelte — Svelte 5 component
|
|
245
|
+
termlings/react — React component
|
|
246
|
+
termlings/vue — Vue component
|
|
247
|
+
termlings/ink — Ink (terminal React) component
|
|
175
248
|
```
|
|
176
249
|
|
|
177
250
|
## License
|