Skip to content

[FEATURE] Add support for from keyword in parseColorFunction - #1639

Merged
oliverklee merged 4 commits into
MyIntervals:mainfrom
samuil-banti-wpenigne:add-support-for-from-keyword-in-parseColorFunction
Sep 26, 2026
Merged

oliverklee merged 4 commits into
MyIntervals:mainfrom
samuil-banti-wpenigne:add-support-for-from-keyword-in-parseColorFunction

Conversation

@samuil-banti-wpenigne

@samuil-banti-wpenigne samuil-banti-wpenigne commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

When we pass values like hsl( triggers Color::parseColorFunction() to parsePrimitiveValue method, the parsing
fails.

The from keyword is not recognized. Instead, Size::parse() is called, which sees fr at the start of from and matches it as the fr, creating Size(0.0, 'fr').

CSS example:

div {
    background-color: hsl(from var(--gcid-lvhfuivypo) calc(h + 0) calc(s + 0) calc(l + 0) / 0.66);
}

@coveralls

coveralls commented Sep 25, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 74.621% (+0.06%) from 74.566% — samuil-banti-wpenigne:add-support-for-from-keyword-in-parseColorFunction into MyIntervals:main

@samuil-banti-wpenigne
samuil-banti-wpenigne marked this pull request as ready for review September 25, 2026 10:53
@samuil-banti-wpenigne samuil-banti-wpenigne changed the title Add support for from keyword in parseColorFunction Add support for "from" keyword in parseColorFunction Sep 25, 2026

@JakeQZ JakeQZ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent to me, and a perfect way of handling from for the time being, until we work out a way of getting it into the Color class.

I like the tests, particularly the nested one.

The only nitpick I have is the naming of a data provider. @oliverklee, do you have anything else to comment on?

@samuil-banti-wpenigne, thanks again for understanding the codebase and finding the best fix, and including a good suite of accompanying tests.

Comment thread tests/Unit/Value/ColorTest.php Outdated
Comment thread tests/Unit/Value/ColorTest.php Outdated
@JakeQZ
JakeQZ requested a review from oliverklee September 25, 2026 23:43
oliverklee and others added 2 commits September 26, 2026 12:32
Co-authored-by: JakeQZ <jake@qzdesign.co.uk>
Co-authored-by: JakeQZ <jake@qzdesign.co.uk>

@oliverklee oliverklee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Thank you for contributing this, @samuil-banti-wpenigne!

@oliverklee
oliverklee merged commit 2e127b8 into MyIntervals:main Sep 26, 2026
26 checks passed
@oliverklee oliverklee changed the title Add support for "from" keyword in parseColorFunction [FEATURE] Add support for from keyword in parseColorFunction Sep 26, 2026
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.

4 participants