Last active
April 16, 2022 20:14
-
-
Save tomaswrobel/20dbed89aaa3e24a4331a58fec479aba to your computer and use it in GitHub Desktop.
(Firefox only) SVG gradients set up via SASS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function svg-gradient($type, $transform, $colors...) { | |
$stops: ""; | |
@each $color, $offset in $colors { | |
$stops: $stops + "<stop offset='#{$offset}' stop-color='#{$color}' />"; | |
} | |
@return url( | |
"data:image/svg+xml;utf8,\ | |
<svg xmlns='http://www.w3.org/2000/svg'> \ | |
<#{$type}Gradient id='grad' style='gradient-transform: #{$transform};'> \ | |
#{$stops} \ | |
</#{$type}Gradient> \ | |
</svg>" | |
+ "#grad" | |
); | |
} | |
circle { | |
fill: svg-gradient(linear, rotate(90deg), black 0%, grey 50%, white 100%) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment