less.js icon indicating copy to clipboard operation
less.js copied to clipboard

fix(issue#4343) add color operands

Open puckowski opened this issue 6 months ago • 1 comments

What:

Add missing color operand support to resolve issue #4343.

Currently the following Less:

background: oklch(from #0000FF calc(l + 0.1) c h);

results in the following error:

Error: Could not parse call arguments or missing ')'

because color components are not being detected as valid operands for an Operation. This PR resolves that issue and also adds tests for oklch, rgb, and hsl.

Why:

Using color components as an operand is valid and should be supported.

Checklist:

  • [ ] Documentation
  • [x] Added/updated unit tests
  • [x] Code complete

puckowski avatar Jun 18 '25 20:06 puckowski

Prior comments from https://github.com/less/less.js/pull/4344 :

This looks good. I wonder a bit if Less should actually calculate the final value, since the color is static in this case (not from a var(), but I think actually it's fine how it is.

puckowski avatar Jun 18 '25 20:06 puckowski