Skip to content

Twelve palettes as shared data, contrast measured - #31

Merged
ecropolis merged 1 commit into
mainfrom
claude/palettes-data
Sep 29, 2026
Merged

ecropolis merged 1 commit into
mainfrom
claude/palettes-data

Conversation

@ecropolis

Copy link
Copy Markdown
Owner

src/data/palettes.ts is now the source for the colour palettes: the portal's six (same slugs, same colors hexes, checked against a hard-coded copy of the portal's values) each followed by the sibling the colour guide names. Framework-free, header names the downstream copies (portal src/brand/palettes.data.ts, console src/domain/palettes.data.ts) and carries the pin rule. README gets a "Palettes" section after "Style boards".

Body SHA-256: 09fe8158686d3a78cc5d68675d4e45f209520f805debf7dbb88127d9db1cdae1

How contrast works

  • paletteContrast(p) is pure and uses WCAG 2.x relative luminance. PALETTES is built from the data by adding its result, so contrast is never typed by hand. Ratios are truncated to two places (never rounded up), and passes is judged against the pair's floor: AA at 4.5 or more, AA-large at 3 or more where the floor is 3, fail below the floor.
  • scripts/check-palettes.mjs measures again independently and requires its numbers to match the file's. It fails if any new palette misses a floor. The originals' failures are listed exactly in KNOWN_FAILS, so a new failure fails the build, and so does a listed one that starts passing.
  • For the original six, the roles come from colors: background, ink (text), primary and accent are unchanged. On-primary is whichever of background or text reads better on the primary. Muted is text mixed 30% toward background, and surface is background mixed 6% toward text.
  • pairsWith is typed by a StyleId union written out in the file, so it can stay importless. The check holds that union equal to STYLE_IDS in styles.ts. No palette has a demo, because no live demo site honestly uses one.

The twelve (roles and measured contrast)

Contrast columns: ink/background · on-primary/primary · accent/background · muted/background. ✗ = under the floor.

id background surface ink muted primary on-primary accent contrast
classic-professional #f7f9fc #eaecf0 #1c2733 #5e666f #1f3a5f #f7f9fc #c9a227 14.35 · 10.88 · 2.29 ✗ · 5.52
slate-and-copper #f5f6f8 #ffffff #1e2530 #566070 #33475b #ffffff #a8552a 14.25 · 9.57 · 4.85 · 5.87
warm-earthy #faf6f0 #eeeae4 #33302b #6f6b66 #9c4a2f #faf6f0 #e0a458 12.2 · 5.67 · 2.02 ✗ · 4.91
terracotta-and-sage #fbf5ee #f3e9dc #2f2a25 #6b6157 #a3472a #ffffff #5f7a55 13.11 · 6.01 · 4.4 · 5.58
bold-modern #ffffff #f2f2f3 #1f2937 #626973 #6d28d9 #ffffff #f43f5e 14.67 · 7.1 · 3.67 · 5.54
ink-and-coral #ffffff #f4f4f7 #14172b #5b5f75 #1b1f3b #ffffff #e04e39 17.68 · 16.08 · 3.94 · 6.29
fresh-natural #f6faf4 #e9eee8 #24382a #637267 #2f7d47 #f6faf4 #f4a259 11.88 · 4.8 · 1.95 ✗ · 4.81
forest-and-cream #faf6ea #f0ead6 #1f2d24 #5a6a5e #1f4d36 #faf6ea #a65f1c 13.32 · 8.94 · 4.54 · 5.31
elegant-neutral #faf9f7 #eeedea #2b2926 #696765 #423e37 #faf9f7 #b08d57 13.78 · 10.1 · 2.93 ✗ · 5.35
stone-and-charcoal #f4f2ee #e9e5de #24262a #62605b #2e3136 #f4f2ee #8a6a4a 13.55 · 11.67 · 4.42 · 5.61
vibrant-playful #fffdf7 #f2f0ec #22223b #646473 #e63946 #fffdf7 #ffb703 15.18 · 4.09 ✗ · 1.71 ✗ · 5.71
sunshine-and-teal #fffaf0 #fff0c2 #12343b #4f6a70 #ffc529 #12343b #0f766e 12.77 · 8.39 · 5.26 · 5.56

Original palettes that fail a floor (hexes unchanged, shown as fail)

Five of the original six fail at least one floor. Only bold-modern passes all four.

  • classic-professional: accent on background 2.29:1 (floor 3)
  • warm-earthy: accent on background 2.02:1 (floor 3)
  • fresh-natural: accent on background 1.95:1 (floor 3)
  • elegant-neutral: accent on background 2.93:1 (floor 3)
  • vibrant-playful: on-primary on primary 4.09:1 (floor 4.5). Neither its background nor its text reaches 4.5 on #e63946, and white doesn't either.
  • vibrant-playful: accent on background 1.71:1 (floor 3)

The accents are light golds and oranges, which work as fills behind dark text but not as text or marks on the light background. The downstream sites should use them that way, or show the fail badge as the data says.

npm run check is green.

🤖 Generated with Claude Code

src/data/palettes.ts takes the portal's six palettes (same slugs, same
hexes) and adds a sibling to each direction. Roles, mood, culture, suits
and style pairings for all twelve; contrast computed by paletteContrast()
and re-measured by scripts/check-palettes.mjs, which prints the body hash
the portal and console pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ecropolis
ecropolis merged commit 2efd6e0 into main Sep 29, 2026
2 checks passed
@ecropolis
ecropolis deleted the claude/palettes-data branch September 29, 2026 12:49
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