Repository navigation
feat(color-converter): accept hex without # and CSS named colors - #501
Open
joshuaallgaier2-cmd wants to merge 2 commits into
Open
joshuaallgaier2-cmd wants to merge 2 commits into
joshuaallgaier2-cmd wants to merge 2 commits into
Conversation
parseColor() now parses 3, 4, 6, and 8 digit hex values that arrive without the # prefix (as Figma's picker shows them) and the 148 CSS Color Module Level 4 named colors, including transparent. currentcolor stays an error because it can only be resolved from the surrounding text color. The input placeholder, the error message, and the color-converter FAQ mention the new formats.
This was referenced Nov 15, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The color converter now accepts hex values without
#and the 148 CSS named colors, case-insensitively, plus transparent.currentcolorremains an error because it depends on the surrounding text color. The placeholder, error message, and FAQ describe the accepted formats.The review revision also rejects inherited object properties such as
constructorand__proto__. Previously, the named-color lookup incorrectly returned opaque black for both. An own-property check limits it to the color table's entries.Closes #496
How I tested this
OpenAI Codex ran these checks on Windows for the latest revision:
npm test: 2,661 passed; two untouched tests timed out at the default five seconds (csv-utils' TypeScript compiler test and RegexTesterClient's 1,000-match navigation test).npm run lint: passed with 11 existing warnings in untouched code.npm run build: passed.To check manually, run
npm run devand open/color-converter. Valid examples includeF26DF0,rebeccapurple,RED, andtransparent;constructorand__proto__should show an error. This manual browser check was not performed during this revision.AI assistance
The original implementation was written with Claude in the DeepSeek Harness. OpenAI Codex reviewed the open PR, reproduced and fixed the inherited-property bug, added regression cases, reviewed the revision diff, and ran the checks reported above. Joshua is not claimed to have personally run or reviewed this revision.
Type of change
Checklist
npm run lint && npm run test && npm run buildpasses locally (two full-suite timeouts; focused reruns passed as described above)lib/and have a test inlib/__tests__/page.tsx, client component,opengraph-image.tsx, and the bug report dropdown are all done (not applicable: existing tool)Notes for reviewers
The named-color table is alphabetically ordered and stores
0xRRGGBBvalues. Transparent is handled separately for its alpha value. The existing claim remains pending: the maintainer said assignment and review will follow once codercops/chatcops#617 merges. No assignment or CI policy was changed.