-
-
Save takumaro-web/f3195dac58ff17f92ff6 to your computer and use it in GitHub Desktop.
This file contains 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
@mixin linear-gradient($angle, $color1, $offset1, $color2 ,$offset2:100, $color3:null, $offset3:100, $color4:null, $offset4:100, $color5:null, $offset5:100){ | |
$angle_webkit:'left top, left bottom'; | |
$angle_svg:'%20x2%3d%220%25%22%20y2%3d%22100%25%22'; | |
$color-stop1_svg:'%3cstop%20style%3d%22stop%2dcolor%3a%23'#{$color1}'%22%20offset%3d%22'#{$offset1}'%25%22%2f%3e'; | |
$color-stop2_svg:'%3cstop%20style%3d%22stop%2dcolor%3a%23'#{$color2}'%22%20offset%3d%22'#{$offset2}'%25%22%2f%3e'; | |
$color-stop3_svg:''; | |
$color-stop4_svg:''; | |
$color-stop5_svg:''; | |
@if $angle == right{ | |
$angle_svg:'%20x2%3d%22100%25%22'; | |
} | |
@if $angle == bottom{ | |
$angle_svg:'%20x2%3d%220%22%20y1%3d%22100%25%22'; | |
} | |
@if $angle == left{ | |
$angle_svg:''; | |
} | |
@if $color3 != null { | |
$color-stop3_svg:'%3cstop%20style%3d%22stop%2dcolor%3a%23'#{$color3}'%22%20offset%3d%22'#{$offset3}'%25%22%2f%3e'; | |
} | |
@if $color4 != null { | |
$color-stop4_svg:'%3cstop%20style%3d%22stop%2dcolor%3a%23'#{$color4}'%22%20offset%3d%22'#{$offset4}'%25%22%2f%3e'; | |
} | |
@if $color5 != null { | |
$color-stop5_svg:'%3cstop%20style%3d%22stop%2dcolor%3a%23'#{$color5}'%22%20offset%3d%22'#{$offset5}'%25%22%2f%3e'; | |
} | |
background-image:url(data:image/svg+xml,%3c%3fxml%20version%3d%221%2e0%22%3f%3e%3csvg%20xmlns%3d%22http%3a%2f%2fwww%2ew3%2eorg%2f2000%2fsvg%22%20width%3d%22100%25%22%20height%3d%22100%25%22%3e%3cdefs%3e%3clinearGradient%20id%3d%22G%22#{$angle_svg}%3e#{$color-stop1_svg}#{$color-stop2_svg}#{$color-stop3_svg}#{$color-stop4_svg}#{$color-stop5_svg}%3c%2flinearGradient%3e%3c%2fdefs%3e%3crect%20width%3d%22100%25%22%20height%3d%22100%25%22%20fill%3d%22url%28%23G%29%22%2f%3e%3c%2fsvg%3e); | |
} |
This file contains 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
background-image: url(data:image/svg+xml,%3c%3fxml%20version%3d%221%2e0%22%3f%3e%3csvg%20xmlns%3d%22http%3a%2f%2fwww%2ew3%2eorg%2f2000%2fsvg%22%20width%3d%22100%25%22%20height%3d%22100%25%22%3e%3cdefs%3e%3clinearGradient%20id%3d%22G%22%20x2%3d%220%25%22%20y2%3d%22100%25%22%3e%3cstop%20stop%2dcolor%3d%22#bce13d%22%20offset%3d%220%%22%2f%3e%3cstop%20stop%2dcolor%3d%22#f7fee7%22%20offset%3d%2250%%22%2f%3e%3cstop%20stop%2dcolor%3d%22black%22%20offset%3d%22100%%22%2f%3e%3c%2flinearGradient%3e%3c%2fdefs%3e%3crect%20width%3d%22100%25%22%20height%3d%22100%25%22%20fill%3d%22url%28%23G%29%22%2f%3e%3c%2fsvg%3e); | |
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #bce13d)color-stop(0%, #bce13d)color-stop(100%, black)); | |
background-image: -webkit-linear-gradient(top, #bce13d 0%,#f7fee7 50%,black 100%); | |
background-image: -moz-linear-gradient(top, #bce13d 0%,#f7fee7 50%,black 100%); | |
background-image: -ms-linear-gradient(top, #bce13d 0%,#f7fee7 50%,black 100%); | |
background-image: -o-linear-gradient(top, #bce13d 0%,#f7fee7 50%,black 100%); | |
background-image: linear-gradient(top, #bce13d 0%,#f7fee7 50%,black 100%); } |
This file contains 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
@import "_mixin_linear-gradient.scss"; | |
.selector{ | |
//引数は、<方向>,<色1>,<位置1>,<色2>,<位置2>,<色3>,<位置3>... | |
//色には#は付けない。また、16進数のみ | |
//offset にはパーセンテージで渡す。単位は付けない | |
@include linear-gradient(top, "BCE13D", 0, "F7FEE7", 50, "000000", 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SVGのみ抜粋。