Created
October 10, 2016 14:04
-
-
Save gemmadlou/d499eee1b8a97946bc87de604c2a6ed0 to your computer and use it in GitHub Desktop.
SVG Image Icons
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
// Compatible with IE10 | |
@function svg-url($svg) { | |
@if not str-index($svg,xmlns) { | |
$svg: str-replace($svg, '<svg','<svg xmlns="http://www.w3.org/2000/svg"'); | |
} | |
$encoded:''; | |
$slice: 2000; | |
$index: 0; | |
$loops: ceil(str-length($svg)/$slice); | |
@for $i from 1 through $loops { | |
$chunk: str-slice($svg, $index, $index + $slice - 1); | |
// | |
// Encode | |
// | |
$chunk: str-replace($chunk,'"', '\''); | |
$chunk: str-replace($chunk,'%', '%25'); | |
$chunk: str-replace($chunk,'&', '%26'); | |
$chunk: str-replace($chunk,'#', '%23'); | |
$chunk: str-replace($chunk,'{', '%7B'); | |
$chunk: str-replace($chunk,'}', '%7D'); | |
$chunk: str-replace($chunk,'<', '%3C'); | |
$chunk: str-replace($chunk,'>', '%3E'); | |
$encoded: #{$encoded}#{$chunk}; | |
$index: $index + $slice; | |
} | |
@return url("data:image/svg+xml,#{$encoded}"); | |
} | |
// Helper function to replace characters in a string | |
@function str-replace($string, $search, $replace: '') { | |
$index: str-index($string, $search); | |
@return if($index, | |
str-slice($string, 1, $index - 1) + $replace + | |
str-replace(str-slice($string, $index + | |
str-length($search)), $search, $replace), | |
$string); | |
} | |
@function svg-arrow-right($color: $white) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 477.175 477.175"><path fill="'+$color+'" d="M360.731 229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1 0s-5.3 13.8 0 19.1l215.5 215.5-215.5 215.5c-5.3 5.3-5.3 13.8 0 19.1 2.6 2.6 6.1 4 9.5 4 3.4 0 6.9-1.3 9.5-4l225.1-225.1c5.3-5.2 5.3-13.8.1-19z"/></svg>'; | |
@return svg-url($svgurl); | |
} | |
@function svg-arrow-left($color: $white) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 477.175 477.175"><path fill="'+$color+'" d="M145.188 238.575l215.5-215.5c5.3-5.3 5.3-13.8 0-19.1s-13.8-5.3-19.1 0l-225.1 225.1c-5.3 5.3-5.3 13.8 0 19.1l225.1 225c2.6 2.6 6.1 4 9.5 4s6.9-1.3 9.5-4c5.3-5.3 5.3-13.8 0-19.1l-215.4-215.5z"/></svg>'; | |
@return svg-url($svgurl); | |
} | |
@function svg-icon-twitter($color: $black) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 612 612"><path fill="'+$color+'" d="M612 116.258a250.714 250.714 0 0 1-72.088 19.772c25.929-15.527 45.777-40.155 55.184-69.411-24.322 14.379-51.169 24.82-79.775 30.48-22.907-24.437-55.49-39.658-91.63-39.658-69.334 0-125.551 56.217-125.551 125.513 0 9.828 1.109 19.427 3.251 28.606-104.326-5.24-196.835-55.223-258.75-131.174-10.823 18.51-16.98 40.078-16.98 63.101 0 43.559 22.181 81.993 55.835 104.479a125.556 125.556 0 0 1-56.867-15.756v1.568c0 60.806 43.291 111.554 100.693 123.104-10.517 2.83-21.607 4.398-33.08 4.398-8.107 0-15.947-.803-23.634-2.333 15.985 49.907 62.336 86.199 117.253 87.194-42.947 33.654-97.099 53.655-155.916 53.655-10.134 0-20.116-.612-29.944-1.721 55.567 35.681 121.536 56.485 192.438 56.485 230.948 0 357.188-191.291 357.188-357.188l-.421-16.253c24.666-17.593 46.005-39.697 62.794-64.861z" /></svg>'; | |
@return svg-url($svgurl); | |
} | |
@function svg-icon-facebook($color: $black) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 430.113 430.114"><path fill="'+$color+'" d="M158.081 83.3v59.218h-43.385v72.412h43.385v215.183h89.122V214.936h59.805s5.601-34.721 8.316-72.685H247.54V92.74c0-7.4 9.717-17.354 19.321-17.354h48.557V.001h-66.021C155.878-.004 158.081 72.48 158.081 83.3z"/></svg>'; | |
@return svg-url($svgurl); | |
} | |
@function svg-icon-youtube($color: $black) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 90"><path fill="'+$color+'" d="M70.939 65.832H66l.023-2.869a2.329 2.329 0 0 1 2.326-2.318h.315a2.332 2.332 0 0 1 2.332 2.318l-.057 2.869zm-18.526-6.148c-1.253 0-2.278.842-2.278 1.873V75.51c0 1.029 1.025 1.869 2.278 1.869 1.258 0 2.284-.84 2.284-1.869V61.557c0-1.032-1.026-1.873-2.284-1.873zM82.5 51.879v26.544C82.5 84.79 76.979 90 70.23 90H19.771C13.02 90 7.5 84.79 7.5 78.423V51.879c0-6.367 5.52-11.578 12.271-11.578H70.23c6.749 0 12.27 5.211 12.27 11.578zM23.137 81.305l-.004-27.961 6.255.002v-4.143l-16.674-.025v4.073l5.205.015v28.039h5.218zm18.75-23.796h-5.215V72.44c0 2.16.131 3.24-.008 3.621-.424 1.158-2.33 2.388-3.073.125-.126-.396-.015-1.591-.017-3.643l-.021-15.034h-5.186l.016 14.798c.004 2.268-.051 3.959.018 4.729.127 1.357.082 2.939 1.341 3.843 2.346 1.69 6.843-.252 7.968-2.668l-.01 3.083 4.188.005-.001-23.79zM58.57 74.607l-.011-12.427c-.004-4.736-3.547-7.572-8.356-3.74l.021-9.239-5.209.008-.025 31.89 4.284-.062.39-1.986c5.473 5.021 8.914 1.58 8.906-4.444zm16.321-1.647l-3.91.021c-.002.155-.008.334-.01.529v2.182c0 1.168-.965 2.119-2.137 2.119h-.766c-1.174 0-2.139-.951-2.139-2.119v-5.739h8.954v-3.37c0-2.463-.063-4.925-.267-6.333-.641-4.454-6.893-5.161-10.051-2.881a5.887 5.887 0 0 0-2.188 2.945c-.444 1.281-.665 3.031-.665 5.254v7.41c.002 12.318 14.964 10.577 13.179-.018zM54.833 32.732a3.55 3.55 0 0 0 1.254 1.584c.56.394 1.276.592 2.134.592.752 0 1.418-.203 1.998-.622.578-.417 1.065-1.04 1.463-1.871l-.099 2.046h5.813V9.74H62.82v19.24a1.907 1.907 0 0 1-3.811 0V9.74h-4.776v16.674c0 2.124.039 3.54.102 4.258.065.713.229 1.397.498 2.06zM37.217 18.77c0-2.373.198-4.226.591-5.562.396-1.331 1.107-2.401 2.137-3.208 1.027-.811 2.342-1.217 3.941-1.217 1.345 0 2.497.264 3.459.781.967.52 1.713 1.195 2.23 2.028a8 8 0 0 1 1.076 2.574c.195.891.291 2.235.291 4.048v6.252c0 2.293-.092 3.98-.271 5.051a8.006 8.006 0 0 1-1.146 3.004c-.58.924-1.329 1.615-2.237 2.056-.918.445-1.968.663-3.154.663-1.325 0-2.441-.183-3.361-.565-.923-.38-1.636-.953-2.144-1.714-.513-.762-.874-1.69-1.092-2.772-.219-1.081-.323-2.707-.323-4.874l.003-6.545zm4.553 9.82c0 1.4 1.042 2.543 2.311 2.543 1.27 0 2.308-1.143 2.308-2.543V15.43c0-1.398-1.038-2.541-2.308-2.541-1.269 0-2.311 1.143-2.311 2.541v13.16zm-16.088 6.645h5.484l.006-18.96L37.652.033h-5.998l-3.445 12.064L24.715 0h-5.936l6.894 16.284.009 18.951z"/></svg>'; | |
@return svg-url($svgurl); | |
} | |
@function svg-icon-instagram($color: $black) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 97.395 97.395"><path fill="'+$color+'" d="M12.501 0h72.393c6.875 0 12.5 5.09 12.5 12.5v72.395c0 7.41-5.625 12.5-12.5 12.5H12.501C5.624 97.395 0 92.305 0 84.895V12.5C0 5.09 5.624 0 12.501 0zm58.447 10.821a4.395 4.395 0 0 0-4.383 4.385v10.495a4.396 4.396 0 0 0 4.383 4.385h11.008a4.398 4.398 0 0 0 4.385-4.385V15.206a4.397 4.397 0 0 0-4.385-4.385H70.948zm15.439 30.367h-8.572a28.486 28.486 0 0 1 1.25 8.355c0 16.2-13.556 29.332-30.275 29.332-16.718 0-30.272-13.132-30.272-29.332 0-2.904.438-5.708 1.25-8.355h-8.945v41.141a3.884 3.884 0 0 0 3.872 3.872h67.822a3.883 3.883 0 0 0 3.872-3.872V41.188h-.002zM48.789 29.533c-10.802 0-19.56 8.485-19.56 18.953s8.758 18.953 19.56 18.953c10.803 0 19.562-8.485 19.562-18.953s-8.758-18.953-19.562-18.953z"/></svg>'; | |
@return svg-url($svgurl); | |
} | |
@function svg-icon-envelope($color: $black) { | |
$svgurl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 511.626 511.626"><path fill="'+$color+'" d="M49.106 178.729c6.472 4.567 25.981 18.131 58.528 40.685 32.548 22.554 57.482 39.92 74.803 52.099 1.903 1.335 5.946 4.237 12.131 8.71 6.186 4.476 11.326 8.093 15.416 10.852 4.093 2.758 9.041 5.852 14.849 9.277 5.806 3.422 11.279 5.996 16.418 7.7 5.14 1.718 9.898 2.569 14.275 2.569h.575c4.377 0 9.137-.852 14.277-2.569 5.137-1.704 10.615-4.281 16.416-7.7 5.804-3.429 10.752-6.52 14.845-9.277 4.093-2.759 9.229-6.376 15.417-10.852 6.184-4.477 10.232-7.375 12.135-8.71 17.508-12.179 62.051-43.11 133.615-92.79 13.894-9.703 25.502-21.411 34.827-35.116 9.332-13.699 13.993-28.07 13.993-43.105 0-12.564-4.523-23.319-13.565-32.264-9.041-8.947-19.749-13.418-32.117-13.418H45.679c-14.655 0-25.933 4.948-33.832 14.844C3.949 79.562 0 91.934 0 106.779c0 11.991 5.236 24.985 15.703 38.974 10.466 13.99 21.604 24.983 33.403 32.976z"/><path d="M483.072 209.275c-62.424 42.251-109.824 75.087-142.177 98.501-10.849 7.991-19.65 14.229-26.409 18.699-6.759 4.473-15.748 9.041-26.98 13.702-11.228 4.668-21.692 6.995-31.401 6.995h-.578c-9.707 0-20.177-2.327-31.405-6.995-11.228-4.661-20.223-9.229-26.98-13.702-6.755-4.47-15.559-10.708-26.407-18.699-25.697-18.842-72.995-51.68-141.896-98.501C17.987 202.047 8.375 193.762 0 184.437v226.685c0 12.57 4.471 23.319 13.418 32.265 8.945 8.949 19.701 13.422 32.264 13.422h420.266c12.56 0 23.315-4.473 32.261-13.422 8.949-8.949 13.418-19.694 13.418-32.265V184.437c-8.186 9.132-17.7 17.417-28.555 24.838z"/></svg>'; | |
@return svg-url($svgurl); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment