Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/less/lib/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2283,10 +2283,10 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
parserInput.save();

// hsl or rgb or lch operand
const match = parserInput.$re(/^[lchrgbs]\s+/);
const match = parserInput.$re(/^([lchrgbs])(?=\s|[,/*)]|$)/);
if (match) {
parserInput.forget();
return new tree.Keyword(match[0]);
return new tree.Keyword(match[1]);
}

parserInput.restore();
Expand Down
6 changes: 6 additions & 0 deletions packages/test-data/tests-unit/color-functions/modern.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@
.color-rgb-div {
background: rgb(from #0000FF calc(r / 2) g b);
}
.color-rgb-sub-right-operand {
background: rgb(from blue calc(100 - r) g b);
}
.color-rgb-add-left-operand {
background: rgb(from blue calc(r + 100) g b);
}
8 changes: 8 additions & 0 deletions packages/test-data/tests-unit/color-functions/modern.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@
.color-rgb-div {
background: rgb(from #0000FF calc(r / 2) g b);
}

.color-rgb-sub-right-operand {
background: rgb(from blue calc(100 - r) g b);
}

.color-rgb-add-left-operand {
background: rgb(from blue calc(r + 100) g b);
}
Loading