Skip to content

Commit 8226166

Browse files
committed
fixup! fix(material/theming): restrict css color usage behind a flag
1 parent 198d669 commit 8226166

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/material/core/style/_sass-utils.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ $use-system-typography-variables: false;
6868
@return color.change($color, $args...);
6969
}
7070
@else if ($color != null and map.get($args, alpha) != null and $use-system-color-variables) {
71-
@return rgb(from $color #{r g b} / map.get($args, alpha));
71+
$opacity: map.get($args, alpha);
72+
@return #{color-mix(in srgb, #{$color} #{($opacity * 100) + '%'}, transparent)};
7273
}
7374
@return $color;
7475
}

src/material/core/tokens/_m3-tokens.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
}
171171
@else if($color != null) {
172172
$result: map.remove($result, $opacity-key);
173-
$combined-color: rgb(from $color #{r g b} / $opacity);
173+
$combined-color: #{color-mix(in srgb, #{$color} #{($opacity * 100) + '%'}, transparent)};
174174
$result: map.set($result, $color-key, $combined-color);
175175
}
176176
}

0 commit comments

Comments
 (0)