Built with blockbuilder.org
Last active
January 18, 2018 20:41
-
-
Save mukhtyar/c14c1512e553d12a8eb0b348c01206d3 to your computer and use it in GitHub Desktop.
SVG Icons
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
license: mit |
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
<!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> |
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
<svg | |
xmlns="http://www.w3.org/2000/svg" | |
version="1.1" | |
viewBox="0 0 120 120"> | |
<circle | |
class="circle__filled" | |
fill="#479c6b" | |
stroke="none" | |
stroke-width="0" | |
r="55" | |
cy="60" | |
cx="60"/> | |
<path | |
class="path__filled" | |
fill="#ffffff" | |
stroke="none" | |
stroke-width="0" | |
d="m 42.211,93.985 c 4.853,0 8.849,-1.234 11.914,-3.662 -8.203,-7.918 -8.356,-20.044 -8.356,-20.226 0,-6.67 2.156,-11.415 6.302,-14.122 -0.802,-2.079 -1.219,-4.123 -1.219,-6.208 0,-8.343 -7.761,-8.634 -8.641,-8.64 -0.353,0 -8.64,0.098 -8.64,8.64 0,5.544 -2.714,9.615 -5.338,13.553 -2.482,3.723 -4.827,7.238 -4.827,11.859 0,0.768 0.215,18.806 18.805,18.806 M 96.594,70.098 c 0,-9.361 -4.36,-13.723 -13.723,-13.723 -1.523,0 -3.077,0.56 -4.461,1.285 -2.472,2.331 -4.814,3.533 -5.021,3.637 -0.012,0.006 -0.026,0.008 -0.04,0.013 -0.021,0.012 -0.043,0.023 -0.065,0.033 -0.006,0.002 -0.01,0.002 -0.016,0.004 -0.048,0.02 -0.097,0.032 -0.149,0.047 -0.028,0.007 -0.053,0.02 -0.081,0.025 -0.107,0.024 -0.217,0.038 -0.332,0.038 -0.129,0 -0.252,-0.021 -0.373,-0.051 -0.032,-0.009 -0.062,-0.02 -0.093,-0.029 -0.032,-0.011 -0.066,-0.019 -0.098,-0.03 -0.004,-0.002 -0.008,-0.003 -0.014,-0.005 -0.061,-0.025 -0.119,-0.059 -0.176,-0.092 -0.014,-0.009 -0.032,-0.011 -0.048,-0.021 -0.006,-0.004 -0.01,-0.011 -0.018,-0.015 -0.093,-0.06 -0.18,-0.128 -0.26,-0.205 -1.29,-1.291 -5.434,-4.635 -9.085,-4.635 -9.361,0 -13.722,4.361 -13.722,13.723 0,0.976 0.272,23.888 23.887,23.888 23.556,0 23.886,-22.914 23.888,-23.887 M 81.235,46.393 c -4.485,1.052 -6.095,6.405 -6.676,10.059 0.581,-0.409 1.234,-0.824 1.937,-1.218 2.093,-2.039 4.235,-4.998 4.739,-8.841 M 33.683,26.062 c 0.673,5.13 4.266,8.688 6.762,10.58 -0.505,-3.643 -2.043,-9.48 -6.762,-10.58 M 20.357,75.18 c 0,-5.544 2.714,-9.615 5.339,-13.552 2.481,-3.723 4.826,-7.239 4.826,-11.86 0,-6.638 3.941,-9.759 7.659,-10.998 -3.242,-2.544 -7.659,-7.311 -7.659,-14.414 0,-0.843 0.683,-1.524 1.525,-1.524 5.326,0 8.392,3.64 10.035,7.835 1.589,-4.771 3.983,-7.239 4.134,-7.388 0.592,-0.594 1.55,-0.595 2.148,-0.005 0.598,0.593 0.602,1.557 0.014,2.155 -0.044,0.045 -4.169,4.357 -4.598,12.761 4.177,0.564 10.121,3.424 10.121,11.578 0,1.636 0.296,3.201 0.896,4.834 2.199,-0.837 4.774,-1.275 7.744,-1.275 3.191,0 6.29,1.689 8.426,3.204 -0.901,-7.072 -4.362,-10.706 -4.425,-10.772 -0.592,-0.595 -0.59,-1.556 0.004,-2.151 0.595,-0.595 1.56,-0.595 2.156,0 0.151,0.15 2.545,2.618 4.133,7.39 1.644,-4.195 4.711,-7.835 10.036,-7.835 0.842,0 1.525,0.682 1.525,1.523 0,3.442 -1.037,6.335 -2.476,8.694 0.316,-0.032 0.633,-0.053 0.951,-0.053 10.973,0 16.772,5.8 16.772,16.771 0,0.257 -0.298,24.518 -23.439,26.754 l -3.496,0.289 -3.5,-0.289 c -5.378,-0.52 -9.528,-2.223 -12.72,-4.546 -2.914,2.48 -6.54,3.987 -10.818,4.505 l -3.375,0.357 -3.554,-0.343 C 20.589,94.637 20.357,75.385 20.357,75.18" /> | |
<circle | |
class="circle__outline" | |
fill="none" | |
stroke="#fff" | |
stroke-width="2" | |
r="55" | |
cy="60" | |
cx="60"/> | |
</svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment