File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
packages/tailwindcss-language-service/src/util Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -51,18 +51,10 @@ const colorRegex = new RegExp(
51
51
function getColorsInString ( str : string ) : ( culori . Color | KeywordColor ) [ ] {
52
52
if ( / (?: b o x | d r o p ) - s h a d o w / . test ( str ) ) return [ ]
53
53
54
- return (
55
- str
56
- . match ( colorRegex )
57
- ?. map ( ( color ) =>
58
- color
59
- . trim ( )
60
- . replace ( / ^ [ , ( ] | [ , ) ] $ / g, '' )
61
- . replace ( / v a r \( [ ^ ) ] + \) / , '1' )
62
- )
63
- . map ( ( color ) => getKeywordColor ( color ) ?? culori . parse ( color ) )
64
- . filter ( Boolean ) ?? [ ]
65
- )
54
+ return Array . from ( str . matchAll ( colorRegex ) , ( match ) => {
55
+ let color = match [ 1 ] . replace ( / v a r \( [ ^ ) ] + \) / , '1' )
56
+ return getKeywordColor ( color ) ?? culori . parse ( color )
57
+ } ) . filter ( Boolean )
66
58
}
67
59
68
60
function getColorFromDecls (
You can’t perform that action at this time.
0 commit comments