@@ -423,18 +423,26 @@ function analyze(css) {
423423 if ( nodeName . length > 20 || nodeName . length < 3 ) {
424424 return this . skip
425425 }
426- let stringified = stringifyNode ( valueNode )
427- let lowerCased = nodeName . toLowerCase ( )
428426
429- if ( namedColors . has ( lowerCased ) ) {
427+ if ( namedColors . has ( nodeName ) ) {
428+ let stringified = stringifyNode ( valueNode )
430429 colors . push ( stringified , property )
431430 colorFormats . push ( 'named' )
432- } else if ( colorKeywords . has ( lowerCased ) ) {
431+ return
432+ }
433+
434+ if ( colorKeywords . has ( nodeName ) ) {
435+ let stringified = stringifyNode ( valueNode )
433436 colors . push ( stringified , property )
434- colorFormats . push ( lowerCased )
435- } else if ( systemColors . has ( lowerCased ) ) {
437+ colorFormats . push ( nodeName . toLowerCase ( ) )
438+ return
439+ }
440+
441+ if ( systemColors . has ( nodeName ) ) {
442+ let stringified = stringifyNode ( valueNode )
436443 colors . push ( stringified , property )
437444 colorFormats . push ( 'system' )
445+ return
438446 }
439447 return this . skip
440448 }
@@ -443,11 +451,11 @@ function analyze(css) {
443451 if ( strEquals ( 'var' , nodeName ) ) {
444452 return this . skip
445453 }
446- let fnName = nodeName . toLowerCase ( )
447- let stringified = stringifyNode ( valueNode )
448- if ( colorFunctions . has ( fnName ) ) {
454+
455+ if ( colorFunctions . has ( nodeName ) ) {
456+ let stringified = stringifyNode ( valueNode )
449457 colors . push ( stringified , property )
450- colorFormats . push ( fnName )
458+ colorFormats . push ( nodeName . toLowerCase ( ) )
451459 }
452460 // No this.skip here intentionally,
453461 // otherwise we'll miss colors in linear-gradient() etc.
0 commit comments