Skip to content

Commit 21887dc

Browse files
Copilotmatthew-dean
andcommitted
revert: undo changes — suggestions moved to review on PR #4434 instead
Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> Agent-Logs-Url: https://github.com/less/less.js/sessions/08abb38c-787e-402a-b782-6b9c55d5f943
1 parent f56ee78 commit 21887dc

3 files changed

Lines changed: 3 additions & 50 deletions

File tree

packages/less/lib/less/parser/parser.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,13 +2282,11 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
22822282
colorOperand: function () {
22832283
parserInput.save();
22842284

2285-
// Single-letter channel keywords used in relative color syntax:
2286-
// r, g, b (rgb), h, s, l (hsl), h, w, b (hwb),
2287-
// l, a, b (lab/oklab), l, c, h (lch/oklch)
2288-
const match = parserInput.$re(/^([abcghlrsw])(?=\s|[,/*)]|$)/);
2285+
// hsl or rgb or lch operand
2286+
const match = parserInput.$re(/^[lchrgbs]\s+/);
22892287
if (match) {
22902288
parserInput.forget();
2291-
return new tree.Keyword(match[1]);
2289+
return new tree.Keyword(match[0]);
22922290
}
22932291

22942292
parserInput.restore();

packages/test-data/tests-unit/color-functions/modern.css

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,3 @@
3434
.color-rgb-div {
3535
background: rgb(from #0000FF calc(r / 2) g b);
3636
}
37-
.color-rgb-calc-sub-right {
38-
background: rgb(from blue calc(100 - r) g b);
39-
}
40-
.color-rgb-calc-add-left {
41-
background: rgb(from blue calc(r + 100) g b);
42-
}
43-
.color-lab-calc-a-add {
44-
background: lab(from blue l calc(a + 5) b);
45-
}
46-
.color-lab-calc-a-sub {
47-
background: lab(from blue l calc(5 - a) b);
48-
}
49-
.color-hwb-calc-w-add {
50-
background: hwb(from blue h calc(w + 10) b);
51-
}
52-
.color-hwb-calc-w-sub {
53-
background: hwb(from blue h calc(10 - w) b);
54-
}

packages/test-data/tests-unit/color-functions/modern.less

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,3 @@
4646
.color-rgb-div {
4747
background: rgb(from #0000FF calc(r / 2) g b);
4848
}
49-
50-
// Regression tests for issue #4316: calc() with channel as right-hand operand
51-
.color-rgb-calc-sub-right {
52-
background: rgb(from blue calc(100 - r) g b);
53-
}
54-
55-
.color-rgb-calc-add-left {
56-
background: rgb(from blue calc(r + 100) g b);
57-
}
58-
59-
// lab/oklab 'a' channel (was missing from character class)
60-
.color-lab-calc-a-add {
61-
background: lab(from blue l calc(a + 5) b);
62-
}
63-
64-
.color-lab-calc-a-sub {
65-
background: lab(from blue l calc(5 - a) b);
66-
}
67-
68-
// hwb 'w' channel (was missing from character class)
69-
.color-hwb-calc-w-add {
70-
background: hwb(from blue h calc(w + 10) b);
71-
}
72-
73-
.color-hwb-calc-w-sub {
74-
background: hwb(from blue h calc(10 - w) b);
75-
}

0 commit comments

Comments
 (0)