Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .claude/skills/reduce-global-palette/skill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: reduce-global-palette
description: Iteratively reduce the global cross-sprite palette one color at a time. Use when the user wants to unify colors across character sprites or shrink the main palette.
version: 1.1.0
---

# Reduce Global Palette

## When to use this skill
When the user wants to shrink the total number of unique colors across all sprites.
Always process **one color at a time** — find one candidate, apply one merge, verify, done.

Invoke with: `/reduce-global-palette`

---

## Phase 1 — Find one color to remove

```
pnpm sprite:candidates
```

This prints a ranked table of cross-sprite color pairs sorted by RGB distance (smallest = safest):

```
dist replace in from-hex → keep in into-hex
9 fighter #BEC1C8 → rogue #B9BBC3
18 barbarian #EA9364 → sorcerer #EA826A
...
```

**Pick the top row** (lowest distance). That is your target.
- Distance < 30: safe to apply directly.
- Distance 30–50: apply and do a visual check before confirming.

---

## Phase 2 — Remove one color

With the chosen row (`replace-in` sprite, `FROM` hex, `INTO` hex):

**Step 1 — Apply the merge**
```
pnpm sprite:merge-colors --input public/assets/sprites/<replace-in>.png --merge FROM:INTO
```

**Step 2 — Upscale and display**
```
pnpm sprite:upscale --input public/assets/sprites/<replace-in>.png --scale 4
```
Read and display `<name>_4x.png`. Confirm no visible change.

**Step 3 — Rebuild main palette**
```
pnpm sprite:build-palette
```
Report the new total unique color count from `main.palette.json`.

---

## Done for this round
One color removed. Stop here and wait for the user to confirm before continuing.
8 changes: 3 additions & 5 deletions .claude/skills/sprite-pipeline/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ Show the final palette table with color roles (outline, skin, leather, cloak, et

### Step 5 — Upscale
```
pnpm sprite:upscale --input <file> --scale 2
pnpm sprite:upscale --input <file> --scale 4
```
Use `--scale 2` (not 4) — AI-generated sprites arrive pre-upscaled and are already larger than the original 32×32 base. Using 4x would produce an oversized image.

After upscaling, read and display the `<name>_2x.png` result image for visual confirmation.
After upscaling, read and display the `<name>_4x.png` result image for visual confirmation.

## Output
- `<name>.png` — processed sprite (transparent background, 10 colors)
- `<name>_2x.png` — upscaled version (the suffix follows `_<scale>x`, e.g. `_2x` for `--scale 2`)
- `<name>_4x.png` — upscaled version (the suffix follows `_<scale>x`, e.g. `_4x` for `--scale 4`)
- `<name>-palette.json` — final palette

## Notes
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"sprite:merge-colors": "node scripts/reduce-palette.mjs",
"sprite:remove-background": "node scripts/remove-background.mjs",
"sprite:flip": "node scripts/flip-sprite.mjs",
"sprite:build-palette": "node scripts/build-main-palette.mjs",
"sprite:candidates": "node scripts/sprite-merge-candidates.mjs",
"blue-ball": "pnpm lint && pnpm test && pnpm build",
"postblue-ball": "pnpm test:coverage && ./.hooks/update-coverage-badge.sh"
},
Expand Down
11 changes: 9 additions & 2 deletions prompts/sprites/class-avatar.prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Template

```
A tiny {CLASS} character sprite in Game Boy pixel art style, 4 colors only using classic Game Boy
A {CLASS} character sprite in Game Boy pixel art style, 4 colors only using classic Game Boy
{CLASS} palette ({PALETTE}), 32x32 pixels, front-facing idle pose, {CLOTHING}, {WEAPON},
{COMPANION}, chunky pixelated outlines, no background, transparent background, retro RPG handheld
game aesthetic, 1990s portable game sprite "no anti-aliasing, hard pixel edges, low resolution
Expand Down Expand Up @@ -48,4 +48,11 @@ Palette order: **darkest → dark → light → lightest**
- Rogue (2026-03-29): v2 accepted (v1 rejected — lacking leather/color, too grey).
> A tiny tall Tiefling Rogue character sprite in Game Boy pixel art style, 32x32 pixels, front-facing idle pose, 6-color palette: dark near-black outline (#030305), deep dark blue-grey (#181820), mid blue-grey (#404058), light silver-grey (#9090a8) for the cloak and armor, warm reddish-purple (#7a2040) for tiefling skin on face and hands, warm brown (#6b3a1a) for leather chest piece and bracers, dark hooded cloak pushed back revealing small curved horns, tight leather armor with visible belt and buckle details, slender tall frame, dagger in raised hand, second dagger at belt, a tiny rat on shoulder, thin devil tail curling from cloak hem, chunky pixelated outlines, no background, transparent background, retro RPG handheld game aesthetic, 1990s portable game sprite "no anti-aliasing, hard pixel edges, low resolution dithering", character facing right (3/4 right-facing view)

- Wizard (2026-03-29): prompt note — must specify character facing right (3/4 right-facing view).
- Wizard (2026-03-29): v1 accepted. Prompt note: must specify character facing right.
> A tiny wizard character sprite in Game Boy pixel art style, 4 colors only using classic Game Boy wizard palette (#020810 #0c2060 #3070d0 #c0d8ff), 32x32 pixels, front-facing idle pose, long robes with star pattern trim, pointed hat, tall staff with gem on top, spellbook at side, small cat familiar or floating scroll, chunky pixelated outlines, no background, transparent background, retro RPG handheld game aesthetic, 1990s portable game sprite "no anti-aliasing, hard pixel edges, low resolution dithering", character facing right (3/4 right-facing view)

- Sorcerer (2026-03-30): v1 good result, not exquisite — saved as baseline.
> A tiny female Aasimar Sorcerer character sprite in Game Boy pixel art style, 32x32 pixels, front-facing idle pose, 6-color palette: dark near-black outline (#080010), deep dark purple (#380868), mid purple (#9040d0), soft pink-white (#f8d0ff) for robe highlights and wing feather tips, warm light skin (#e8c490) for face and hands, bright near-white (#f4f0e8) for large feathered aasimar wings spread slightly behind her, flowing robe with arcane rune trim, arcane orb held forward no staff, large feathered wings fanned slightly behind back — NO halo, small magical purple flames flickering around her body as an arcane aura — at her feet, along her arms, framing the wings — NO animal companion, chunky pixelated outlines, no background, transparent background, retro RPG handheld game aesthetic, 1990s portable game sprite "no anti-aliasing, hard pixel edges, low resolution dithering", character facing right (3/4 right-facing view)

- Sorcerer (2026-03-30): v2 accepted — red tones, aasimar wings, no halo, no animal companion.
> A female Aasimar Sorcerer character sprite in Game Boy pixel art style, 32x32 pixels, front-facing idle pose, 6-color palette: dark near-black outline (#080010), deep crimson-dark (#3a0010), vivid red (#c02030) for flames and clothing details, warm rose-gold (#f8a080) for robe highlights and flame tips, warm light skin (#e8c490) for face and hands, bright near-white (#f4f0e8) for large feathered aasimar wings spread slightly behind her, gorgeous elegant flowing crimson sorcerer robes with ornate gold-red trim and arcane runes, low neckline, dramatic silhouette, arcane orb held forward no staff, large feathered wings fanned slightly behind back — NO halo, vivid red magical flames flickering around her body as an arcane aura — at her feet, along her arms, framing the wings — NO animal companion, chunky pixelated outlines, no background, transparent background, retro RPG handheld game aesthetic, 1990s portable game sprite "no anti-aliasing, hard pixel edges, low resolution dithering", character facing right (3/4 right-facing view)
34 changes: 34 additions & 0 deletions public/assets/sprites/barbarian-palette.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"hex": "#030307",
"pixels": 1256
},
{
"hex": "#832B10",
"pixels": 787
},
{
"hex": "#EA9364",
"pixels": 510
},
{
"hex": "#B64826",
"pixels": 390
},
{
"hex": "#3B1F17",
"pixels": 348
},
{
"hex": "#EFB88B",
"pixels": 288
},
{
"hex": "#BA724D",
"pixels": 284
},
{
"hex": "#FFFFFE",
"pixels": 16
}
]
Binary file added public/assets/sprites/barbarian.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/sprites/barbarian_4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 7 additions & 19 deletions public/assets/sprites/druid-palette.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
[
{
"hex": "#030307",
"pixels": 624
},
{
"hex": "#8BAC0F",
"pixels": 489
"pixels": 494
},
{
"hex": "#38692C",
"pixels": 487
},
{
"hex": "#092907",
"pixels": 460
},
{
"hex": "#21491F",
"pixels": 279
},
{
"hex": "#062205",
"pixels": 162
},
{
"hex": "#433B15",
"hex": "#3B1F17",
"pixels": 72
},
{
Expand All @@ -36,15 +32,7 @@
"pixels": 41
},
{
"hex": "#CDFDB0",
"hex": "#FFFFFE",
"pixels": 12
},
{
"hex": "#86A91D",
"pixels": 4
},
{
"hex": "#85AA3A",
"pixels": 1
}
]
Binary file modified public/assets/sprites/druid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/sprites/druid_4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions public/assets/sprites/fighter-palette.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"hex": "#010217",
"hex": "#030307",
"pixels": 404
},
{
Expand All @@ -12,7 +12,7 @@
"pixels": 149
},
{
"hex": "#BEC1C8",
"hex": "#B9BBC3",
"pixels": 105
},
{
Expand All @@ -24,15 +24,15 @@
"pixels": 21
},
{
"hex": "#ECBD9A",
"hex": "#EFB88B",
"pixels": 20
},
{
"hex": "#8897A3",
"pixels": 11
},
{
"hex": "#BA7A66",
"hex": "#BA724D",
"pixels": 5
},
{
Expand Down
Binary file modified public/assets/sprites/fighter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/sprites/fighter_4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading