One palette per frame, chosen by the shallowest override in the open tab

A frame is drawn in exactly one palette, or one blend of two while a palette
lane tweens. Shapes store slots and the raster index is the slot, so the
palette is only the ramp a frame is expanded through: there is no way for two
palettes' colours to share a frame. The per-palette index banks are gone.

Every symbol drawn says which palette it chooses — its lane, its instance's
palette, its own — and the shallowest wins, so a palette set on the open
symbol beats anything inside it, and a child set to one turns the whole frame
while it is drawn. Nothing chosen is the project's palette.

The palette grid follows the palette the stage is in, per tab, read from the
player rather than worked out again; mid-tween it holds the start palette.
Another can be opened per tab, with a button back to the active one.

The chooser puts the palettes the open symbol uses first, saying where, then
the project's, then palettes made in other projects (with their project, and
searchable by either name), each with the playhead's frame drawn in it;
hovering previews on the stage, `use` sets the symbol to it. The classics are
a folded shelf, now with VGA, Commodore 64, CGA and Workbench 1.3, and a new
project carries only the palette it was made with.

Unused slots are marked; solo shows and lets you click only what is drawn in
the chosen colour; ⌫ empties the open palette's unused slots in place.
The project palette can be changed in the inspector. The palette lane's
label no longer collides with the sidebar grid's styles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Olive Vaughn 2026-10-10 19:47:44 -04:00
parent 641f1fa18c
commit 1a6d6564c5
22 changed files with 865 additions and 428 deletions

View file

@ -436,8 +436,8 @@ class DocumentTests(TestCase):
self.assertEqual(200, self.save(leaves).status_code)
rows = self.client.get("/api/symbols").json()["palettes"]
self.assertEqual(
[("Moonlit", "night", "c1")],
[(r["name"], r["palette"], r["cid"]) for r in rows],
[("Moonlit", "night", "c1", ["#001122"])],
[(r["name"], r["palette"], r["cid"], r["hexes"]) for r in rows],
)
def test_a_document_comes_back_exactly(self):

View file

@ -413,6 +413,26 @@ def footage_list(request):
_SYMBOL_LEAF = re.compile(r"^clip/([^/]+)/symbol/([^/]+)$")
_PALETTE_LEAF = re.compile(r"^clip/([^/]+)/palette/([^/]+)$")
_HEX = re.compile(r"#[0-9a-fA-F]{6}")
def _slot_hexes(value):
"""A palette leaf's slot colours, in order. Every slot carries exactly one
hex, so they are read off whatever follows `:slots` without decoding
transit's caches."""
if not isinstance(value, list) or "~:slots" not in value:
return []
out = []
def walk(x):
if isinstance(x, list):
for y in x:
walk(y)
elif isinstance(x, str) and _HEX.fullmatch(x):
out.append(x.lower())
walk(value[value.index("~:slots") + 1])
return out
def _transit_fields(value, *keys):
@ -459,6 +479,9 @@ def symbols(request):
"cid": m.group(1),
"palette": m.group(2),
"name": fields.get("name") or m.group(2).replace("~", "/"),
# Every slot carries exactly one hex, in order, so the strip is
# read off the value without decoding transit's caches.
"hexes": _slot_hexes(leaf.value),
})
palettes.sort(key=lambda r: (r["project_name"], r["project"], r["name"]))
return JsonResponse({"symbols": rows, "palettes": palettes})