@@ -484,7 +484,7 @@ protected function move(ConverterInterface $converter, $content)
484484 /**
485485 * Shorthand HEX color codes.
486486 * #FF0000FF -> #f00 -> red
487- * #FF00FF00 -> transparent
487+ * #FF00FF00 -> transparent.
488488 *
489489 * @param string $content The CSS content to shorten the HEX color codes for
490490 *
@@ -504,13 +504,13 @@ protected function shortenHexColors($content)
504504
505505 $ colors = array (
506506 // make these more readable
507- '#00f ' => 'blue ' ,
507+ '#00f ' => 'blue ' ,
508508 '#dc143c ' => 'crimson ' ,
509- '#0ff ' => 'cyan ' ,
509+ '#0ff ' => 'cyan ' ,
510510 '#8b0000 ' => 'darkred ' ,
511511 '#696969 ' => 'dimgray ' ,
512512 '#ff69b4 ' => 'hotpink ' ,
513- '#0f0 ' => 'lime ' ,
513+ '#0f0 ' => 'lime ' ,
514514 '#fdf5e6 ' => 'oldlace ' ,
515515 '#87ceeb ' => 'skyblue ' ,
516516 '#d8bfd8 ' => 'thistle ' ,
@@ -536,7 +536,7 @@ protected function shortenHexColors($content)
536536 '#ffc0cb ' => 'pink ' ,
537537 '#dda0dd ' => 'plum ' ,
538538 '#800080 ' => 'purple ' ,
539- '#f00 ' => 'red ' ,
539+ '#f00 ' => 'red ' ,
540540 '#fa8072 ' => 'salmon ' ,
541541 '#a0522d ' => 'sienna ' ,
542542 '#c0c0c0 ' => 'silver ' ,
@@ -547,13 +547,13 @@ protected function shortenHexColors($content)
547547 '#ee82ee ' => 'violet ' ,
548548 '#f5deb3 ' => 'wheat ' ,
549549 // or the other way around
550- 'black ' => '#000 ' ,
550+ 'black ' => '#000 ' ,
551551 'fuchsia ' => '#f0f ' ,
552552 'magenta ' => '#f0f ' ,
553- 'white ' => '#fff ' ,
554- 'yellow ' => '#ff0 ' ,
553+ 'white ' => '#fff ' ,
554+ 'yellow ' => '#ff0 ' ,
555555 // and also `transparent`
556- 'transparent ' => '#fff0 '
556+ 'transparent ' => '#fff0 ' ,
557557 );
558558
559559 return preg_replace_callback (
@@ -587,12 +587,12 @@ protected function convertLegacyColors($content)
587587 $ content = preg_replace ('/(rgb|hsl)a?\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)/i ' , '$1($2 $3 $4) ' , $ content );
588588
589589 // convert `rgb` to `hex`
590- $ dec = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]) ' ;// [000-255] THX @ https://www.regular-expressions.info/numericranges.html
590+ $ dec = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]) ' ; // [000-255] THX @ https://www.regular-expressions.info/numericranges.html
591+
591592 return preg_replace_callback (
592593 "/rgb\( $ dec $ dec $ dec\)/i " ,
593- function ($ match )
594- {
595- return sprintf ('#%02x%02x%02x ' , $ match [1 ],$ match [2 ],$ match [3 ]);
594+ function ($ match ) {
595+ return sprintf ('#%02x%02x%02x ' , $ match [1 ], $ match [2 ], $ match [3 ]);
596596 },
597597 $ content
598598 );
@@ -620,10 +620,10 @@ protected function cleanupModernColors($content)
620620 $ tag = '(rgb|hsl|hwb|(?:(?:ok)?(?:lch|lab))) ' ;
621621
622622 // remove alpha channel if it's pointless ..
623- $ content = preg_replace ('/ ' . $ tag. '\(([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+\/\s+1(?:[\.\d]*|00%)?\)/i ' , '$1($2 $3 $4) ' , $ content );
623+ $ content = preg_replace ('/ ' . $ tag . '\(([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+\/\s+1(?:[\.\d]*|00%)?\)/i ' , '$1($2 $3 $4) ' , $ content );
624624
625625 // replace `transparent` with shortcut ..
626- $ content = preg_replace ('/ ' . $ tag. '\([^\s]+\s+[^\s]+\s+[^\s]+\s+\/\s+0(?:[\.0%]*)?\)/i ' , '#fff0 ' , $ content );
626+ $ content = preg_replace ('/ ' . $ tag . '\([^\s]+\s+[^\s]+\s+[^\s]+\s+\/\s+0(?:[\.0%]*)?\)/i ' , '#fff0 ' , $ content );
627627
628628 return $ content ;
629629 }
0 commit comments