Skip to content

Commit 14cac01

Browse files
committed
Check if identifier is color or not
1 parent d798e0a commit 14cac01

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

lib/utils/propertyDescriptors.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"use strict";
22

3+
const {
4+
utils: { isColor }
5+
} = require("@asamuzakjp/css-color");
36
const parsers = require("../parsers");
47

58
// Constants
@@ -80,11 +83,18 @@ function createGenericPropertyDescriptor(property, { caseSensitive, dimensionTyp
8083
this._setProperty(property, val, priority);
8184
break;
8285
}
83-
case AST_TYPES.GLOBAL_KEYWORD:
84-
case AST_TYPES.IDENTIFIER: {
86+
case AST_TYPES.GLOBAL_KEYWORD: {
8587
this._setProperty(property, name, priority);
8688
break;
8789
}
90+
case AST_TYPES.IDENTIFIER: {
91+
if ((colorType || paintType) && isColor(value)) {
92+
this._setProperty(property, parsers.serializeColor(parsedValue), priority);
93+
} else {
94+
this._setProperty(property, name, priority);
95+
}
96+
break;
97+
}
8898
case AST_TYPES.PERCENTAGE: {
8999
let numericType;
90100
if (percentageType) {

0 commit comments

Comments
 (0)