Skip to content

Commit

Permalink
fix: compress rgba() colors in gradient, like rgb() colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Cerdic committed Sep 21, 2023
1 parent 827f92e commit 187b973
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion class.csstidy_optimise.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function cut_color($color) {
// on ne touche pas aux couleurs dans les expression ms, c'est trop sensible
if (stripos($color, 'progid:') !== false)
return $color;
preg_match_all(",rgb\([^)]+\),i", $color, $matches, PREG_SET_ORDER);
preg_match_all(",rgba?\([^)]+\),i", $color, $matches, PREG_SET_ORDER);
if (count($matches)) {
foreach ($matches as $m) {
$color = str_replace($m[0], $this->cut_color($m[0]), $color);
Expand Down
6 changes: 3 additions & 3 deletions testing/unit-tests/csst/properties/preserve-merging-rtl.csst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ array (
),
'.gradient' =>
array (
'background-image' => '-webkit-gradient(linear,right bottom,right top,color-stop(0.15,rgba(215,240,240,0.9)),color-stop(0.5,rgba(235,250,250,0)))',
'background-image ' => '-moz-linear-gradient(bottom,rgba(215,240,240,0.9),rgba(235,250,250,0)) #ebf7f9',
'background-image' => '-webkit-gradient(linear,right bottom,right top,color-stop(0.15,#d7f0f0e6),color-stop(0.5,#ebfafa00))',
'background-image ' => '-moz-linear-gradient(bottom,#d7f0f0e6,#ebfafa00) #ebf7f9',
),
)
--SETTINGS--
discard_invalid_properties=false
reverse_left_and_right=true
optimise_shorthands=0
css_level='CSS21'
css_level='CSS21'
6 changes: 3 additions & 3 deletions testing/unit-tests/csst/properties/preserve-merging.csst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ array (
),
'.gradient' =>
array (
'background-image' => '-webkit-gradient(linear,left bottom,left top,color-stop(0.15,rgba(215,240,240,0.9)),color-stop(0.5,rgba(235,250,250,0)))',
'background-image ' => '-moz-linear-gradient(bottom,rgba(215,240,240,0.9),rgba(235,250,250,0)) #ebf7f9',
'background-image' => '-webkit-gradient(linear,left bottom,left top,color-stop(0.15,#d7f0f0e6),color-stop(0.5,#ebfafa00))',
'background-image ' => '-moz-linear-gradient(bottom,#d7f0f0e6,#ebfafa00) #ebf7f9',
),
)
--SETTINGS--
discard_invalid_properties=false
optimise_shorthands=0
css_level='CSS21'
css_level='CSS21'
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ array (
),
'.radial' =>
array (
'background' => '-webkit-gradient(radial,45 45,10,52 50,30,from(#A7D30C),to(rgba(1,159,98,0)),color-stop(90%,#019F62))',
'background' => '-webkit-gradient(radial,45 45,10,52 50,30,from(#A7D30C),to(#019f6200),color-stop(90%,#019F62))',
),
)
--SETTINGS--
Expand Down

0 comments on commit 187b973

Please sign in to comment.