pixel-sprite-maker: spritec - .sprite text format -> png/jpg/svg + sprite sheets

- .sprite format: single-char palette keys (hex/rgb()/CSS names/none), grid
  rows, '.' transparent by default, max 256x256 per sprite
- render/sheet/info/preview subcommands; sheets name themselves
  <base>_<cellW>x<cellH>_<cols>x<rows>.<ext> (row-major)
- SVG output RLE-merges pixel runs; JPG composites over --bg
- go tests for parser, colors, scaling, svg, sheet layout

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmdG9GqfSWCzts7AkDwRDh
This commit is contained in:
2026-07-14 02:21:57 +02:00
parent 581e37acd8
commit 23135a96d1
21 changed files with 1444 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# A small gold coin, 8x8.
# '.' is transparent by default and never needs a palette entry.
sprite: coin
palette:
k = #1A1205 dark outline
y = #FFD700 gold
Y = #FFF3A0 highlight
s = #B8860B shadow
grid:
..kkkk..
.kyyyYk.
kyyyYYsk
kyyYyysk
kyYyyysk
kYyyyssk
.kysssk.
..kkkk..

View File

@@ -0,0 +1,25 @@
# A 16x16 heart with shading, shows named colors and rgb().
sprite: heart
palette:
k = #2B0A10 outline
r = crimson main red
R = rgb(255, 90, 110) light red
d = #8B1A2B dark red
w = #FFFFFFCC semi-transparent shine
grid:
................
..kkk....kkk....
.krrRk..kRrrk...
krrRRrkkrRrrrk..
krRwRrrrrrrrdk..
krRwwRrrrrrrdk..
krRwRrrrrrrddk..
krrRrrrrrrrddk..
.krrrrrrrrrdk...
..krrrrrrrdk....
...krrrrrdk.....
....krrrdk......
.....krdk.......
......kk........
................
................

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

View File

@@ -0,0 +1,34 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 8 8" shape-rendering="crispEdges">
<rect x="2" y="0" width="4" height="1" fill="#1a1205"/>
<rect x="1" y="1" width="1" height="1" fill="#1a1205"/>
<rect x="2" y="1" width="3" height="1" fill="#ffd700"/>
<rect x="5" y="1" width="1" height="1" fill="#fff3a0"/>
<rect x="6" y="1" width="1" height="1" fill="#1a1205"/>
<rect x="0" y="2" width="1" height="1" fill="#1a1205"/>
<rect x="1" y="2" width="3" height="1" fill="#ffd700"/>
<rect x="4" y="2" width="2" height="1" fill="#fff3a0"/>
<rect x="6" y="2" width="1" height="1" fill="#b8860b"/>
<rect x="7" y="2" width="1" height="1" fill="#1a1205"/>
<rect x="0" y="3" width="1" height="1" fill="#1a1205"/>
<rect x="1" y="3" width="2" height="1" fill="#ffd700"/>
<rect x="3" y="3" width="1" height="1" fill="#fff3a0"/>
<rect x="4" y="3" width="2" height="1" fill="#ffd700"/>
<rect x="6" y="3" width="1" height="1" fill="#b8860b"/>
<rect x="7" y="3" width="1" height="1" fill="#1a1205"/>
<rect x="0" y="4" width="1" height="1" fill="#1a1205"/>
<rect x="1" y="4" width="1" height="1" fill="#ffd700"/>
<rect x="2" y="4" width="1" height="1" fill="#fff3a0"/>
<rect x="3" y="4" width="3" height="1" fill="#ffd700"/>
<rect x="6" y="4" width="1" height="1" fill="#b8860b"/>
<rect x="7" y="4" width="1" height="1" fill="#1a1205"/>
<rect x="0" y="5" width="1" height="1" fill="#1a1205"/>
<rect x="1" y="5" width="1" height="1" fill="#fff3a0"/>
<rect x="2" y="5" width="3" height="1" fill="#ffd700"/>
<rect x="5" y="5" width="2" height="1" fill="#b8860b"/>
<rect x="7" y="5" width="1" height="1" fill="#1a1205"/>
<rect x="1" y="6" width="1" height="1" fill="#1a1205"/>
<rect x="2" y="6" width="1" height="1" fill="#ffd700"/>
<rect x="3" y="6" width="3" height="1" fill="#b8860b"/>
<rect x="6" y="6" width="1" height="1" fill="#1a1205"/>
<rect x="2" y="7" width="4" height="1" fill="#1a1205"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

View File

@@ -0,0 +1,57 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" shape-rendering="crispEdges">
<rect x="2" y="0" width="3" height="1" fill="#101018"/>
<rect x="10" y="0" width="3" height="1" fill="#101018"/>
<rect x="2" y="1" width="1" height="1" fill="#101018"/>
<rect x="3" y="1" width="2" height="1" fill="#f2c09a"/>
<rect x="10" y="1" width="1" height="1" fill="#101018"/>
<rect x="11" y="1" width="2" height="1" fill="#f2c09a"/>
<rect x="2" y="2" width="1" height="1" fill="#101018"/>
<rect x="3" y="2" width="2" height="1" fill="#f2c09a"/>
<rect x="10" y="2" width="1" height="1" fill="#101018"/>
<rect x="11" y="2" width="2" height="1" fill="#f2c09a"/>
<rect x="1" y="3" width="1" height="1" fill="#101018"/>
<rect x="2" y="3" width="3" height="1" fill="#2e5fb7"/>
<rect x="5" y="3" width="1" height="1" fill="#101018"/>
<rect x="9" y="3" width="1" height="1" fill="#101018"/>
<rect x="10" y="3" width="3" height="1" fill="#2e5fb7"/>
<rect x="13" y="3" width="1" height="1" fill="#101018"/>
<rect x="2" y="4" width="3" height="1" fill="#2e5fb7"/>
<rect x="10" y="4" width="3" height="1" fill="#2e5fb7"/>
<rect x="2" y="5" width="3" height="1" fill="#22406e"/>
<rect x="10" y="5" width="3" height="1" fill="#22406e"/>
<rect x="2" y="6" width="1" height="1" fill="#22406e"/>
<rect x="4" y="6" width="1" height="1" fill="#22406e"/>
<rect x="9" y="6" width="1" height="1" fill="#22406e"/>
<rect x="13" y="6" width="1" height="1" fill="#22406e"/>
<rect x="2" y="7" width="1" height="1" fill="#101018"/>
<rect x="4" y="7" width="1" height="1" fill="#101018"/>
<rect x="9" y="7" width="1" height="1" fill="#101018"/>
<rect x="13" y="7" width="1" height="1" fill="#101018"/>
<rect x="2" y="8" width="3" height="1" fill="#101018"/>
<rect x="10" y="8" width="3" height="1" fill="#101018"/>
<rect x="2" y="9" width="1" height="1" fill="#101018"/>
<rect x="3" y="9" width="2" height="1" fill="#f2c09a"/>
<rect x="10" y="9" width="1" height="1" fill="#101018"/>
<rect x="11" y="9" width="2" height="1" fill="#f2c09a"/>
<rect x="2" y="10" width="1" height="1" fill="#101018"/>
<rect x="3" y="10" width="2" height="1" fill="#f2c09a"/>
<rect x="10" y="10" width="1" height="1" fill="#101018"/>
<rect x="11" y="10" width="2" height="1" fill="#f2c09a"/>
<rect x="2" y="11" width="3" height="1" fill="#2e5fb7"/>
<rect x="5" y="11" width="1" height="1" fill="#101018"/>
<rect x="9" y="11" width="1" height="1" fill="#101018"/>
<rect x="10" y="11" width="3" height="1" fill="#2e5fb7"/>
<rect x="13" y="11" width="1" height="1" fill="#101018"/>
<rect x="1" y="12" width="1" height="1" fill="#101018"/>
<rect x="2" y="12" width="3" height="1" fill="#2e5fb7"/>
<rect x="10" y="12" width="3" height="1" fill="#2e5fb7"/>
<rect x="2" y="13" width="3" height="1" fill="#22406e"/>
<rect x="10" y="13" width="3" height="1" fill="#22406e"/>
<rect x="2" y="14" width="1" height="1" fill="#22406e"/>
<rect x="4" y="14" width="1" height="1" fill="#22406e"/>
<rect x="10" y="14" width="2" height="1" fill="#22406e"/>
<rect x="2" y="15" width="1" height="1" fill="#101018"/>
<rect x="4" y="15" width="1" height="1" fill="#101018"/>
<rect x="9" y="15" width="1" height="1" fill="#101018"/>
<rect x="12" y="15" width="1" height="1" fill="#101018"/>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,16 @@
# Frame 1/4 of a tiny walking guy, 8x8. Legs together.
sprite: walk_1
palette:
k = #101018 outline / hair
s = #F2C09A skin
b = #2E5FB7 shirt
d = #22406E pants
grid:
..kkk...
..kss...
..kss...
.kbbbk..
..bbb...
..ddd...
..d.d...
..k.k...

View File

@@ -0,0 +1,16 @@
# Frame 2/4 - right leg forward.
sprite: walk_2
palette:
k = #101018 outline / hair
s = #F2C09A skin
b = #2E5FB7 shirt
d = #22406E pants
grid:
..kkk...
..kss...
..kss...
.kbbbk..
..bbb...
..ddd...
.d...d..
.k...k..

View File

@@ -0,0 +1,16 @@
# Frame 3/4 - legs together again (same pose as 1, arms swung).
sprite: walk_3
palette:
k = #101018 outline / hair
s = #F2C09A skin
b = #2E5FB7 shirt
d = #22406E pants
grid:
..kkk...
..kss...
..kss...
..bbbk..
.kbbb...
..ddd...
..d.d...
..k.k...

View File

@@ -0,0 +1,16 @@
# Frame 4/4 - left leg forward.
sprite: walk_4
palette:
k = #101018 outline / hair
s = #F2C09A skin
b = #2E5FB7 shirt
d = #22406E pants
grid:
..kkk...
..kss...
..kss...
.kbbbk..
..bbb...
..ddd...
..dd....
.k..k...