Skip to content

Commit d1d0266

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

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lib/utils/propertyDescriptors.js

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

3+
const { utils: { isColor } } = require("@asamuzakjp/css-color");
34
const parsers = require("../parsers");
45

56
// Constants
@@ -80,11 +81,18 @@ function createGenericPropertyDescriptor(property, { caseSensitive, dimensionTyp
8081
this._setProperty(property, val, priority);
8182
break;
8283
}
83-
case AST_TYPES.GLOBAL_KEYWORD:
84-
case AST_TYPES.IDENTIFIER: {
84+
case AST_TYPES.GLOBAL_KEYWORD: {
8585
this._setProperty(property, name, priority);
8686
break;
8787
}
88+
case AST_TYPES.IDENTIFIER: {
89+
if ((colorType || paintType) && isColor(value)) {
90+
this._setProperty(property, parsers.serializeColor(parsedValue), priority);
91+
} else {
92+
this._setProperty(property, name, priority);
93+
}
94+
break;
95+
}
8896
case AST_TYPES.PERCENTAGE: {
8997
let numericType;
9098
if (percentageType) {

0 commit comments

Comments
 (0)