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
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"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<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"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="115"
height="115"
viewBox="0 0 115 115"
enable-background="new 0 0 792 612"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="topic-financing3.svg"><metadata
id="metadata413"><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 /></cc:Work></rdf:RDF></metadata><defs
id="defs411" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="1000"
id="namedview409"
showgrid="false"
inkscape:zoom="4.68"
inkscape:cx="52.18378"
inkscape:cy="39.001686"
inkscape:window-x="1280"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" /><circle
style="fill:none;stroke:#ffffff;stroke-width:3.26600003"
id="circle315"
r="54.798"
cy="485.431"
cx="260.83099"
clip-path="url(#SVGID_26_)"
transform="translate(-203.33099,-427.931)" /><path
style="fill:#5D9CEC;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"
inkscape:connector-curvature="0"
id="path313"
d="m 260.831,540.229 c -30.264,0 -54.798,-24.534 -54.798,-54.798 0,-30.266 24.534,-54.798 54.798,-54.798 30.264,0 54.798,24.532 54.798,54.798 -0.001,30.263 -24.534,54.798 -54.798,54.798"
clip-path="url(#SVGID_26_)"
transform="translate(-203.33099,-427.931)" /><g
id="g4160"><path
style="fill:#ffffff;stroke:none"
id="path10"
d="m 79.868421,73.289473 -52.631578,0 c -0.726316,0 -1.315789,-0.589474 -1.315789,-1.31579 l 0,-36.842104 c 0,-0.726316 0.589473,-1.31579 1.315789,-1.31579 l 52.631578,0 c 0.726316,0 1.31579,0.589474 1.31579,1.31579 l 0,36.842104 c 0,0.726316 -0.589474,1.31579 -1.31579,1.31579 z m -51.315788,-2.631579 49.999999,0 0,-34.210526 -49.999999,0 0,34.210526 z"
inkscape:connector-curvature="0" /><path
style="fill:#ffffff;stroke:none"
id="path16"
d="m 53.547369,62.763157 c -3.507895,0 -6.331579,-2.105263 -6.568421,-4.9 -0.06053,-0.723684 0.476316,-1.360526 1.2,-1.421052 0.652632,-0.07895 1.363158,0.473684 1.421053,1.2 0.115789,1.371052 1.886842,2.489473 3.947368,2.489473 2.144737,0 3.952631,-1.205263 3.952631,-2.631578 0,-1.284211 -1.247368,-2.110527 -3.921052,-2.602632 l -0.289474,-0.05526 c -4.268421,-0.786842 -6.315789,-2.534211 -6.315789,-5.236842 0,-2.902632 2.952631,-5.263158 6.58421,-5.263158 3.507895,0 6.331579,2.105263 6.568421,4.897368 0.06053,0.723685 -0.476316,1.363158 -1.2,1.423685 -0.689473,0.05526 -1.363158,-0.473685 -1.421052,-1.2 -0.11579,-1.373685 -1.886842,-2.489474 -3.947369,-2.489474 -2.142105,0 -3.952631,1.205263 -3.952631,2.631579 0,1.28421 1.25,2.110526 3.931579,2.605263 l 0.286842,0.05526 C 58.089474,53.052631 60.131579,54.8 60.131579,57.5 c 0,2.902631 -2.952631,5.263157 -6.58421,5.263157 z"
inkscape:connector-curvature="0" /><path
style="fill:#ffffff;stroke:none"
id="path20"
d="m 53.552632,65.394736 c -0.726316,0 -1.315789,-0.589473 -1.315789,-1.315789 l 0,-21.052631 c 0,-0.726316 0.589473,-1.31579 1.315789,-1.31579 0.726316,0 1.31579,0.589474 1.31579,1.31579 l 0,21.052631 c 0,0.726316 -0.589474,1.315789 -1.31579,1.315789 z"
inkscape:connector-curvature="0" /><path
style="fill:#ffffff;stroke:none"
id="path24"
d="m 74.605263,41.710526 -5.263157,0 c -0.726316,0 -1.31579,-0.589474 -1.31579,-1.315789 0,-0.726316 0.589474,-1.31579 1.31579,-1.31579 l 5.263157,0 c 0.726316,0 1.31579,0.589474 1.31579,1.31579 0,0.726315 -0.589474,1.315789 -1.31579,1.315789 z"
inkscape:connector-curvature="0" /><path
style="fill:#ffffff;stroke:none"
id="path32"
d="m 87.763158,81.18421 -52.631578,0 c -0.726316,0 -1.31579,-0.589474 -1.31579,-1.31579 l 0,-2.631579 c 0,-0.726316 0.589474,-1.315789 1.31579,-1.315789 0.726316,0 1.315789,0.589473 1.315789,1.315789 l 0,1.31579 49.999999,0 0,-34.210526 -1.315789,0 c -0.726316,0 -1.31579,-0.589474 -1.31579,-1.315789 0,-0.726316 0.589474,-1.31579 1.31579,-1.31579 l 2.631579,0 c 0.726316,0 1.315789,0.589474 1.315789,1.31579 l 0,36.842104 c 0,0.726316 -0.589473,1.31579 -1.315789,1.31579 z"
inkscape:connector-curvature="0" /><path
style="fill:#ffffff;stroke:none"
id="path28"
d="m 37.763159,68.026315 -5.263158,0 c -0.726316,0 -1.31579,-0.589474 -1.31579,-1.315789 0,-0.726316 0.589474,-1.31579 1.31579,-1.31579 l 5.263158,0 c 0.726316,0 1.315789,0.589474 1.315789,1.31579 0,0.726315 -0.589473,1.315789 -1.315789,1.315789 z"
inkscape:connector-curvature="0" /></g></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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment