Skip to content

Add palette organization and JSON round-trip import#11

Merged
Artsen merged 1 commit into
mainfrom
feat/palette-organization-portability
Jul 25, 2026
Merged

Add palette organization and JSON round-trip import#11
Artsen merged 1 commit into
mainfrom
feat/palette-organization-portability

Conversation

@Artsen

@Artsen Artsen commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Give every active palette color a stable internal ID and optional 80-character name.
  • Add accessible Move up and Move down actions with stable selection, focus restoration, and polite announcements.
  • Add strict browser-only ColorCraft JSON import from empty and active Create states, including unsaved-work confirmation.
  • Use color names and exact workspace order in CSS, Tailwind, SVG, JSON, persistence, Library, Review, and Suggestions.
  • Add deterministic screenshots, portable round-trip Playwright coverage, axe coverage, and updated user/architecture/privacy documentation.

Internal saved-palette contract

  • Saved palette schemaVersion changes from 1 to 2.
  • Version 2 saved colors include stable id, optional name, HEX, RGB, HSL, and optional extraction metadata.
  • Schema-version-1, version-0, and unversioned records remain readable and receive deterministic legacy color IDs.
  • Listing the Library does not rewrite migrated records; the next explicit save writes version 2.
  • Saved palette duplication retains order and data while creating a new palette identity and new color IDs.

Portable JSON contract

  • Exported portable JSON changes from schemaVersion: 1 to schemaVersion: 2 and adds format: "colorcraft-palette".
  • Version 2 preserves palette name, exact sequential order, optional Unicode color names, HEX/RGB/HSL, optional extraction metadata, per-color role descriptions, and authoritative top-level role assignments.
  • Internal workspace color IDs are deliberately excluded.
  • Import accepts ColorCraft portable versions 1 and 2, rejects arbitrary/future/unknown or contradictory data, validates UTF-8 and the complete file before activation, and enforces a centralized 1 MB limit.
  • Imported palettes are activated without source-image bytes and remain unsaved until Save palette is selected.

Backend API effects

None. No endpoint, request, response, backend schema, port, or analysis behavior changes. Analysis and suggestion requests continue to send only HEX, RGB, and HSL.

Generated export behavior

  • Named colors generate normalized, deduplicated ASCII kebab-case CSS custom properties and Tailwind keys.
  • SVG rows show escaped user-facing names with HEX values and retain measured black-or-white label contrast.
  • Unnamed exports retain the existing palette-1, palette-2 numeric fallback.
  • JSON remains deterministic and contains no internal IDs.

Validation

  • python check.py through the repository Python 3.11 environment: passed all 10 stages.
  • Frontend: 104 tests passed; 91.79% statements, 84.97% branches, 73.00% functions, 91.79% lines.
  • Backend: 78 tests passed; 86% total coverage.
  • Playwright: 5 workflows passed, including full JSON download/import/save/reopen round trip.
  • axe: no serious or critical violations in empty Create, named/reorderable editor, import error, imported palette, Review, Export, and Library states.
  • pnpm review:screenshots: passed; 16 deterministic screenshots generated and curated inventory updated.
  • git diff --check: passed.

Known limitation

Role assignments still reference HEX values by design. Duplicate colors with the same HEX value therefore share role associations even when their internal IDs or names differ. Pointer drag sorting and non-ColorCraft import formats remain out of scope.

@Artsen
Artsen marked this pull request as ready for review July 25, 2026 22:54
@Artsen
Artsen merged commit e83c9ce into main Jul 25, 2026
1 check passed
@Artsen
Artsen deleted the feat/palette-organization-portability branch July 25, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant