Skip to content

fix(theming): accept rgb() and hsl() values in the color generators - #4820

Open
thetaPC wants to merge 2 commits into
mainfrom
color-regex
Open

thetaPC wants to merge 2 commits into
mainfrom
color-regex

Conversation

@thetaPC

@thetaPC thetaPC commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Issue URL: N/A

What is the current behavior?

The color generators' text input accepts rgb() and hsl() values, but none of the generators handle them:

  • Parsing reads the regex's full match instead of its capture groups, so rgb(12,34,56) produces an -rgb value of NaN,12,34, and hsl() produces negative channels
  • The Color Generator and New Color generator add # to any value without one, so they print #rgb(12,34,56)

What is the new behavior?

  • rgb() and hsl() values parse correctly: rgb(12,34,56) produces 12,34,56
  • Only bare hex such as 0054e9 gets a # added; rgb() and hsl() values are printed as entered

Does this introduce a breaking change?

  • Yes
  • No

Other information

To test, paste rgb(12,34,56) into a color field on each preview page and compare its output with production:

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Nov 3, 2026 3:38am UTC

Request Review

@thetaPC thetaPC changed the title fix(theming): parse rgb() and hsl() values in the color generators fix(theming): accept rgb() and hsl() values in the color generators Nov 3, 2026
@thetaPC
thetaPC marked this pull request as ready for review November 3, 2026 16:05
@thetaPC
thetaPC requested a review from a team as a code owner November 3, 2026 16:05
@thetaPC
thetaPC requested a review from ShaneK November 3, 2026 16:05

This branch was successfully deployed

1 active deployment
Preview — f62d9129 Deployed Nov 3, 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