Skip to content

perf(core): pack the named-color table - #226

Merged
pbroom merged 2 commits into
mainfrom
perf/core-size-budget
Oct 10, 2026
Merged

pbroom merged 2 commits into
mainfrom
perf/core-size-budget

Conversation

@pbroom

@pbroom pbroom commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Store the 141 distinct CSS Color 4 keywords as one alphabetical,
prefix-coded string (a digit for the letters shared with the previous
name, then the rest) plus one string of fixed-width rrggbb values,
decoded into a Map on first lookup. grey spellings still fold onto gray
and transparent is added separately.

parse + toHex + contrastRatio: 5336 B -> 5233 B gzip (-103 B)
everyday toolkit: 5380 B -> 5281 B gzip (-99 B)

Add a test that the packed table decodes to exactly the CSS Color 4
keyword list (checked against colorjs.io).

Part of the color-kit assessment stack (#204 → #227). Build, test, lint, typecheck, format, size and check:artifacts pass.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

This was referenced Oct 6, 2026

pbroom commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Repacks the named color lookup table for bundle size.

The PR appears safe to merge; no actionable issues were found.

What we checked:

  • Longer hex values still parse: parse passes the result to hexToRgb, which accepts both lengths. It also expands the unchanged 0000 value into transparent black.

Summary

Packs CSS named colors into prefix-coded names and fixed-width hex values. namedColorTable decodes them once, on first lookup.

  • Keeps grey aliases and transparent.
  • Adds full-table checks against colorjs.io, plus checks for invalid names.
  • No actionable issues found. Tests were not run.

Reviews (1) · Last reviewed commit: "perf(core): pack the named-color table"

@pbroom
pbroom force-pushed the perf/core-size-budget branch from 989e986 to 9c62afa Compare October 7, 2026 23:28
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
color-kit Ready Ready Preview Oct 10, 2026 7:52pm UTC

@pbroom
pbroom force-pushed the perf/core-size-budget branch from 9c62afa to a44bd65 Compare October 8, 2026 02:44

pbroom commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner Author

Merge activity

  • Oct 10, 6:47 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 10, 7:42 PM UTC: Graphite rebased this pull request as part of a merge.
  • Oct 10, 7:42 PM UTC: @pbroom merged this pull request with Graphite.

@pbroom
pbroom changed the base branch from feat/core-p3-hint to graphite-base/226 October 10, 2026 19:39
@pbroom
pbroom changed the base branch from graphite-base/226 to main October 10, 2026 19:40
pbroom and others added 2 commits October 10, 2026 19:41
Store the 141 distinct CSS Color 4 keywords as one alphabetical,
prefix-coded string (a digit for the letters shared with the previous
name, then the rest) plus one string of fixed-width rrggbb values,
decoded into a Map on first lookup. grey spellings still fold onto gray
and transparent is added separately.

parse + toHex + contrastRatio: 5336 B -> 5233 B gzip (-103 B)
everyday toolkit:              5380 B -> 5281 B gzip (-99 B)

Add a test that the packed table decodes to exactly the CSS Color 4
keyword list (checked against colorjs.io).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Named-color packing brings parse + toHex + contrastRatio to 5.40 kB and
the everyday toolkit to 5.46 kB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@pbroom
pbroom force-pushed the perf/core-size-budget branch from a44bd65 to badd114 Compare October 10, 2026 19:41
@pbroom
pbroom merged commit f8a61ab into main Oct 10, 2026
6 of 7 checks passed
@pbroom
pbroom deleted the perf/core-size-budget branch October 10, 2026 19:42

This branch was successfully deployed

1 active deployment
Preview — badd114b Deployed Oct 10, 2026 by vercel[bot]
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