Skip to content

supporting transparent hex colors#24

Merged
davideast merged 1 commit into
google-labs-code:mainfrom
tototofu123:fix/transparent-colors
Apr 22, 2026
Merged

supporting transparent hex colors#24
davideast merged 1 commit into
google-labs-code:mainfrom
tototofu123:fix/transparent-colors

Conversation

@tototofu123

Copy link
Copy Markdown
Contributor

add support for 4-digit and 8-digit HEX color codes (e.g., #RGBA and #RRGGBBAA) in the design.md CLI linter. Previously, the linter only accepted opaque 3 or 6-digit hex codes.

Related Issues
Fixes #14

Changes

  • Type Definition: Added an optional a (alpha) channel field to the ResolvedColor interface in spec.ts.
  • Validation: Updated the isValidColor regex to accept 4 and 8 character hex strings.
  • Parsing Logic:
    • Updated parseColor in handler.ts to correctly normalize #RGBA shorthand to #RRGGBBAA.
    • Implemented alpha extraction logic (converting 0-255 hex values to a 0-1 float).
    • Exported parseColor for better testability.
  • Tests: Added new test cases in handler.test.ts to verify normalization and alpha extraction for transparent hex codes.

Verification

  • Ran bun test in packages/cli.
  • Verified that all 72 existing and new tests pass.

@davideast

Copy link
Copy Markdown
Collaborator

@tototofu123 This is so great! Thank you for a well done PR.

@davideast davideast merged commit 677eace into google-labs-code:main Apr 22, 2026
3 checks passed
@tototofu123 tototofu123 deleted the fix/transparent-colors branch April 23, 2026 13:16
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.

Support transparent colors

2 participants