Skip to content

Commit 63b340c

Browse files
New Feature: webpage now displays <img> of SVG (#834)
* Webpage now displays <img> of SVG * Update docs/index.html Co-authored-by: David Leal <halfpacho@gmail.com> * Add a hint to change width/height for svg/img Co-authored-by: David Leal <halfpacho@gmail.com>
1 parent b6adba3 commit 63b340c

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

docs/assets/js/script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
8888
$scope.selectedFontIcon = $scope.icons[0].font[0];
8989
$scope.selectedSvgIcon = $scope.selectSvg($scope.icons[0].svg[0], 0);
9090
$scope.selectedFontIndex = 0;
91+
$scope.selectedSvgIndex = 0;
9192

9293
/*------ End of "Re-format devicon.json" ------*/
9394
});
@@ -101,6 +102,7 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
101102
$scope.selectedFontIcon = icon.font[0];
102103
$scope.selectedFontIndex = 0;
103104
$scope.selectedSvgIcon = $scope.selectSvg(icon.svg[0], 0);
105+
$scope.selectedSvgIndex = 0;
104106

105107
// reset color
106108
$scope.fontBackground = DEFAULT_BACKGROUND;
@@ -154,6 +156,7 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
154156
}
155157
});
156158
}
159+
157160
/*---- End of "Change selected svg icon" ----*/
158161
});
159162

docs/index.html

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,16 @@ <h4>Font versions <input type='color' value='#60be86' ng-model="fontBackground">
6666
</li>
6767
</div>
6868
</ul>
69+
<p>Place this in your header</p>
70+
<div class="cde">
71+
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@{{ latestReleaseTagging }}/devicon.min.css"&gt;
72+
</div>
73+
74+
<p>Use this in your body</p>
6975
<div class="cde">
70-
<div class="cde-com">&lt;!-- in your header --&gt;</div>
71-
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@{{ latestReleaseTagging }}/devicon.min.css"&gt;<br />
72-
<br />
73-
<div class="cde-com">&lt;!-- in your body --&gt;</div>
7476
&lt;i class="devicon-{{selectedIcon.name}}-{{selectedFontIcon}}<span ng-if="colored"> colored</span>"&gt;&lt;/i&gt;<br />
7577
</div>
78+
<p><i>*To change the size, change the <code>i</code>'s <code>font-size</code></i></p>
7679
</li>
7780
<li>
7881
<h4>SVG versions <input type='color' value='#60be86' ng-model="svgBackground"></h4>
@@ -81,11 +84,21 @@ <h4>SVG versions <input type='color' value='#60be86' ng-model="svgBackground"></
8184
<img ng-src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/{{selectedIcon.name}}/{{selectedIcon.name}}-{{svgVersion}}.svg">
8285
</li>
8386
</ul>
87+
<p>Using &lt;img&gt; element</p>
88+
<div class="cde">
89+
&lt;img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/{{selectedIcon.name}}/{{selectedIcon.name}}-{{selectedIcon.svg[selectedSvgIndex]}}.svg" /&gt;<br />
90+
</div>
91+
<p><i>*To change the size, change the <code>img</code>'s <code>height</code> and <code>width</code></i></p>
92+
93+
<br />
94+
95+
<p>Using Pure SVG</p>
8496
<div class="cde">
85-
&lt;svg viewBox="0 0 128 128"&gt;<br />
86-
<div class="cde-ind">{{selectedSvgIcon}}</div>
87-
&lt;/svg&gt;
97+
&lt;svg viewBox="0 0 128 128"&gt;<br />
98+
<div class="cde-ind">{{selectedSvgIcon}}</div>
99+
&lt;/svg&gt;
88100
</div>
101+
<p><i>*To change the size, change the <code>svg</code>'s <code>height</code> and <code>width</code></i></p>
89102
</li>
90103
</ul>
91104

0 commit comments

Comments
 (0)