Skip to content

Instantly share code, notes, and snippets.

@mukhtyar
Last active January 18, 2018 20:41
Show Gist options
  • Save mukhtyar/c14c1512e553d12a8eb0b348c01206d3 to your computer and use it in GitHub Desktop.
Save mukhtyar/c14c1512e553d12a8eb0b348c01206d3 to your computer and use it in GitHub Desktop.
SVG Icons
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
.container, .container-new {
width: 100%;
height: 100%;
margin: 1rem;
background-color: #fafafa;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
}
.icon {
flex: 0 1 20%;
display: flex;
flex-direction: column;
align-items: center;
}
svg {
width: 50%;
height: 50%;
}
</style>
</head>
<body>
<h3>Existing Topic Icons</h3>
<div class="container">
</div>
<h3>Options for New Topic Icons</h3>
<div class="container equity"></div>
<div class="container financing"></div>
<div class="container tribal"></div>
<script>
var existingIcons = [
{
color: '#479c6b',
topic: 'agriculture'
},
{
color: '#3c5882',
topic: 'biodiversity-and-habitat'
},
{
color: '#809530',
topic: 'parks-recreation-and-historic-and-cultural'
},
{
color: '#a73f3b',
topic: 'emergency-management'
},
{
color: '#ce8a34',
topic: 'energy'
},
{
color: '#1d6440',
topic: 'forestry'
},
{
color: '#815a54',
topic: 'land-use-and-community-development'
},
{
color: '#009290',
topic: 'ocean-and-coast'
},
{
color: '#bc3a6d',
topic: 'public-health'
},
{
color: '#7f5a79',
topic: 'transportation'
},
{
color: '#138db8',
topic: 'water'
}
];
var equityIcons = [
{
color: '#479c6b',
topic: 'equity-and-environmental-justice1'
},
{
color: '#3c5882',
topic: 'equity-and-environmental-justice2'
},
];
var financingIcons = [
{
color: '#809530',
topic: 'financing1'
},
{
color: '#a73f3b',
topic: 'financing2'
},
{
color: '#a73f3b',
topic: 'financing3'
},
];
var tribalIcons = [
{
color: '#1d6440',
topic: 'tribal-and-indigenous-communities1'
},
{
color: '#1d6440',
topic: 'tribal-and-indigenous-communities2'
},
];
function loadSvgFile(filename, className) {
d3.xml(filename).mimeType('image/svg+xml').get(function(error, xml) {
if (error) throw error;
var icon = d3.select('.' + className)
.append('div')
.classed('icon', true)
.node();
icon.appendChild(xml.documentElement);
var span = document.createElement('span');
var topic = filename.split('.')[0];
span.innerHTML = topic.split('topic-')[1];
icon.appendChild(span)
});
}
existingIcons.forEach(function(item){
loadSvgFile('topic-' + item.topic + '.svg', 'container');
});
equityIcons.forEach(function(item){
loadSvgFile('topic-' + item.topic + '.svg', 'equity');
});
financingIcons.forEach(function(item){
loadSvgFile('topic-' + item.topic + '.svg', 'financing');
});
tribalIcons.forEach(function(item){
loadSvgFile('topic-' + item.topic + '.svg', 'tribal');
});
</script>
</body>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 120 120"
id="svg2"
version="1.1">
<metadata
id="metadata21">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs19" />
<circle
class="circle__filled"
fill="#9b59bf"
stroke="none"
stroke-width="0"
r="55"
cy="60"
cx="60"
id="circle4" />
<circle
id="circle11"
class="circle__outline"
fill="none"
stroke="#ffffff"
stroke-width="2"
r="55"
cy="60"
cx="60" />
<path
id="path3"
d="m 51.551727,49.137932 c 0,7.241378 -8.448275,7.241378 -8.448275,7.241378 0,0 -8.44828,0 -8.44828,-7.241378 0,-7.241379 8.44828,-16.896551 8.44828,-16.896551 0,0 8.448275,9.655172 8.448275,16.896551 z"
style="fill:none" />
<path
id="path5"
d="m 73.275864,41.896553 c 0,7.241379 -8.448276,7.241379 -8.448276,7.241379 0,0 -8.448275,0 -8.448275,-7.241379 0,-7.241379 8.448275,-16.89655 8.448275,-16.89655 0,0 8.448276,9.655171 8.448276,16.89655 z"
style="fill:none" />
<path
id="path7"
d="m 95,49.137932 c 0,7.241378 -8.448275,7.241378 -8.448275,7.241378 0,0 -8.448276,0 -8.448276,-7.241378 0,-7.241379 8.448276,-16.896551 8.448276,-16.896551 0,0 8.448275,9.655172 8.448275,16.896551 z"
style="fill:none" />
<path
id="path9"
d="m 88.482759,87.493101 -1.231035,0.63 c -7.699999,3.835517 -13.782757,6.876896 -21.217239,6.876896 -7.094137,0 -26.334485,-6.251724 -29.351727,-7.241379 l -11.682757,0 0,-21.724136 9.655171,0 c 0.917242,0 1.424138,0 3.113793,-1.713793 2.606897,-2.582758 5.503453,-3.862069 8.882763,-3.862069 2.8,0 5.455172,0.866552 8.013792,1.713793 2.317241,0.748276 4.513793,1.448276 6.541379,1.448276 5.768965,0 14.482757,0 14.482757,6.034482 0,6.034483 -4.803447,6.034483 -12.068964,6.034483 l -0.241379,0 c -1.206897,0 -2.631035,0 -3.55069,0.09655 1.037931,2.872414 2.437931,3.331035 6.978276,4.851724 0.724137,0.243793 1.544827,0.362069 2.43793,0.362069 3.186207,0 6.903448,-1.547241 10.162069,-2.920689 3.041379,-1.279311 5.672413,-2.389655 7.989654,-2.389655 2.317241,0 4.443793,1.882758 5.047241,4.441379 0.528621,2.341379 -0.219655,5.503447 -3.961034,7.362068 z"
style="fill:none;stroke:#ffffff;stroke-opacity:1" />
<rect
id="rect11"
height="21.724136"
width="9.6551714"
y="66.034485"
x="25.000008"
style="fill:none" />
<path
id="path13"
d="m 87.396552,75.689654 c -0.651724,0 -1.351724,0.09655 -2.051724,0.241379 l 0,0.965517 c 0,0.337931 0.144828,0.434483 0.337931,0.434483 0.243793,0 0.533448,-0.09655 0.868966,-0.09655 0.675862,0 1.206896,0.340345 1.206896,-0.337931 l 0,-1.158621 c -0.12069,-0.04827 -0.241379,-0.04827 -0.362069,-0.04827 z"
style="fill:#4d5152" />
<path
id="path15"
d="m 92.441379,80.131033 c -0.57931,-2.413793 -2.510344,-4.248276 -4.682758,-4.393104 l 0,1.158621 c 0,0.675862 -0.531034,0.337931 -1.206896,0.337931 -0.337931,0 -0.627587,0.09655 -0.868966,0.09655 -0.193103,0 -0.337931,-0.09655 -0.337931,-0.434483 l 0,-0.965517 c -1.786207,0.410345 -3.765517,1.233448 -5.93793,2.150689 -3.258621,1.373449 -6.975862,2.92069 -10.162069,2.92069 -0.893103,0 -1.713793,-0.12069 -2.43793,-0.362069 -0.265518,-0.09655 -0.533449,-0.166552 -0.772414,-0.241379 l 0,-4.731035 c 5.889655,-0.05069 9.655171,-0.675862 9.655171,-6.010344 0,-4.489655 -4.827585,-5.648275 -9.655171,-5.93793 l 0,-14.675861 c 2.317241,-0.313793 7.241379,-1.617241 7.241379,-7.144827 0,-7.241379 -8.448276,-16.89655 -8.448276,-16.89655 0,0 -8.448275,9.652757 -8.448275,16.894136 0,5.527586 4.924138,6.831034 7.241379,7.144827 l 0,14.603447 c -0.844828,-0.02414 -1.641379,-0.02414 -2.413793,-0.02414 -2.027586,0 -4.224138,-0.7 -6.541379,-1.448276 -2.55862,-0.847241 -5.213792,-1.713793 -8.013792,-1.713793 -0.82069,0 -1.593103,0.07241 -2.341379,0.217242 l 0,-4.393103 c 2.317241,-0.313793 7.241378,-1.617242 7.241378,-7.144827 0,-7.241379 -8.448275,-16.896551 -8.448275,-16.896551 0,0 -8.44828,9.655172 -8.44828,16.896551 0,5.527585 4.924138,6.831034 7.241384,7.144827 l 0,5.141379 c -1.472419,0.654137 -2.824143,1.617241 -4.127591,2.896551 -1.689655,1.713793 -2.196551,1.713793 -3.113793,1.713793 l -9.655171,0 0,21.724136 11.682757,0 c 3.017242,0.989655 22.255176,7.241379 29.351727,7.241379 7.434482,0 13.51724,-3.041379 21.217239,-6.87931 l 1.231035,-0.63 c 3.741379,-1.856207 4.489655,-5.018275 3.95862,-7.359654 z M 58.793106,41.896553 c 0,-4.055172 3.475862,-9.606896 6.034482,-13.034482 2.558621,3.427586 6.034483,8.97931 6.034483,13.034482 0,3.5 -2.993104,4.465517 -4.827586,4.731034 l 0,-5.93793 c 0,-0.675862 -0.531035,-1.206897 -1.206897,-1.206897 -0.675862,0 -1.206896,0.531035 -1.206896,1.206897 l 0,5.93793 C 61.786209,46.36207 58.793106,45.396553 58.793106,41.896553 Z m -21.724141,7.241379 c 0,-4.055172 3.475862,-9.606896 6.034487,-13.034482 2.558621,3.427586 6.034483,8.97931 6.034483,13.034482 0,3.499999 -2.993104,4.465517 -4.827586,4.731034 l 0,-5.937931 c 0,-0.675862 -0.531035,-1.206896 -1.206897,-1.206896 -0.675862,0 -1.206896,0.531034 -1.206896,1.206896 l 0,5.937931 c -1.834488,-0.265517 -4.827591,-1.231035 -4.827591,-4.731034 z m -4.827586,36.206893 -4.827585,0 0,-16.89655 4.827585,0 0,16.89655 z m 55.155173,0 c -8.182758,4.07931 -14.120688,7.241379 -21.362067,7.241379 -7.241379,0 -28.96552,-7.241379 -28.96552,-7.241379 l -2.413793,0 0,-16.89655 c 1.255173,0 2.413793,0 4.827586,-2.413793 2.365522,-2.365517 4.755177,-3.162069 7.16897,-3.162069 4.827586,0 9.727585,3.162069 14.555171,3.162069 4.827586,0 12.068965,0 12.068965,3.620689 0,3.62069 -2.413793,3.62069 -9.655172,3.62069 l -0.241379,0 c -4.658621,0 -6.903448,0.02414 -6.034483,2.703448 1.448276,4.53793 3.789655,5.310344 8.689655,6.951723 1.037931,0.337931 2.124138,0.482759 3.210344,0.482759 6.587241,0 13.999999,-5.310344 18.151723,-5.310344 2.413793,0 4.827586,4.827585 0,7.241378 z m -23.77586,-9.655171 0,3.83793 c -2.124138,-0.866551 -3.041379,-1.689655 -3.789655,-3.741379 0.917241,-0.09655 2.341379,-0.09655 3.548276,-0.09655 l 0.241379,0 z"
style="fill:#ffffff;fill-opacity:1" />
<path
id="path17"
d="m 86.551725,32.241381 c 0,0 -8.448276,9.655172 -8.448276,16.896551 0,5.527585 4.924138,6.831034 7.241379,7.144827 l 0,20.613791 c 0,0.337931 0.144828,0.434483 0.337931,0.434483 0.243793,0 0.533448,-0.09655 0.868966,-0.09655 0.675862,0 1.206896,0.340345 1.206896,-0.337931 l 0,-20.613791 C 90.075862,55.968966 95,54.665517 95,49.137932 95,41.896553 86.551725,32.241381 86.551725,32.241381 Z m 1.206896,21.627585 0,-5.937931 c 0,-0.675862 -0.531034,-1.206896 -1.206896,-1.206896 -0.675862,0 -1.206897,0.531034 -1.206897,1.206896 l 0,5.937931 c -1.834483,-0.265517 -4.827586,-1.231035 -4.827586,-4.731034 0,-4.055172 3.475862,-9.606896 6.034483,-13.034482 2.55862,3.427586 6.034482,8.97931 6.034482,13.034482 0,3.499999 -2.993103,4.465517 -4.827586,4.731034 z"
style="fill:#ffffff;fill-opacity:1" />
</svg>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment