Skip to content

Commit d8e5694

Browse files
committed
v1.1.0
- Change the way to request the icon - Has compatibility with v.1.0.1
1 parent b709322 commit d8e5694

File tree

10 files changed

+73
-70
lines changed

10 files changed

+73
-70
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"files.insertFinalNewline": true
3+
}

README.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
<div align="center">
32

4-
# Devicon API ![](https://deviconapi.vercel.app/?devicon&size=40)
3+
# Devicon API v1.1.0 ![](https://deviconapi.vercel.app/?devicon&size=40)
54

65
<a href="#">
76
<img src="https://shields.io/badge/English-000dff">
@@ -38,13 +37,12 @@
3837
## 1. Overview
3938
&emsp;Use the base URL below to access the API.
4039
```https
41-
https://deviconapi.vercel.app/?
40+
https://deviconapi.vercel.app/
4241
```
43-
> *You can use `/api?` instead of `/?` at the end of the link if you want.*
4442

4543
<div align="center">
4644

47-
**Through this documentation this base URL will be referred as `<URL>/?`**
45+
**Through this documentation this base URL will be referred as `<URL>/`**
4846
</div>
4947

5048
[***Jump to examples >>***](#2-examples)
@@ -59,9 +57,9 @@ https://deviconapi.vercel.app/?
5957

6058
***Example***
6159
```https
62-
<URL>/?csharp
63-
<URL>/?cplusplus
64-
<URL>/?javascript
60+
<URL>/csharp
61+
<URL>/cplusplus
62+
<URL>/javascript
6563
```
6664

6765
<div align="right">
@@ -86,16 +84,16 @@ https://deviconapi.vercel.app/?
8684
***Example***
8785
```html
8886
<picture>
89-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
90-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
87+
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/devicon?theme=dark&size=50">
88+
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/devicon?theme=light&size=50">
9189
</picture>
9290
```
9391

9492
***Result***
9593
<div align="center">
9694
<picture>
97-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
98-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
95+
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/devicon?theme=dark&size=50">
96+
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/devicon?theme=light&size=50">
9997
</picture>
10098
</div>
10199

@@ -106,13 +104,13 @@ https://deviconapi.vercel.app/?
106104
***Example using `dark`***\
107105
&emsp;Next.js icon filled in `#ffffff`
108106
```https
109-
<URL>/?nextjs&theme=dark
107+
<URL>/nextjs?theme=dark
110108
```
111109

112110
***Example using `light`***\
113111
&emsp;Next.js icon filled in `#000000`
114112
```https
115-
<URL>/?nextjs&theme=light
113+
<URL>/nextjs?theme=light
116114
```
117115

118116
<div align="right">
@@ -133,13 +131,13 @@ https://deviconapi.vercel.app/?
133131
***Example using hexadecimal***\
134132
&emsp;JavaScript icon filled in `#ff5656`
135133
```https
136-
<URL>/?javascript&color=ff5656
134+
<URL>/javascript?color=ff5656
137135
```
138136

139137
***Example using CSS color***\
140138
&emsp;JavaScript icon filled in `#ff0000`
141139
```https
142-
<URL>/?javascript&color=red
140+
<URL>/javascript?color=red
143141
```
144142

145143
<div align="right">
@@ -161,7 +159,7 @@ https://deviconapi.vercel.app/?
161159
***Example using `line`***\
162160
&emsp;Apache icon in `line` version where default is `plain`.
163161
```https
164-
<URL>/?apache&version=line
162+
<URL>/apache?version=line
165163
```
166164

167165
<div align="right">
@@ -175,7 +173,7 @@ https://deviconapi.vercel.app/?
175173
***Example using 50px***\
176174
&emsp;Node.js icon in 50×50px.
177175
```https
178-
<URL>/?nodejs&size=50
176+
<URL>/nodejs?size=50
179177
```
180178

181179
<div align="right">
@@ -187,15 +185,15 @@ https://deviconapi.vercel.app/?
187185
### 2.1. Markdown
188186
#### nodejs, dark theme, 80px
189187
```markdown
190-
![](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
188+
![](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
191189
```
192190
#### go, 180px, #f0f
193191
```markdown
194-
![](https://deviconapi.vercel.app/?go&size=180&color=f0f)
192+
![](https://deviconapi.vercel.app/go?size=180&color=f0f)
195193
```
196194
#### go, original-wordmark, 180px
197195
```markdown
198-
![](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
196+
![](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
199197
```
200198

201199
<div align="right">
@@ -206,15 +204,15 @@ https://deviconapi.vercel.app/?
206204
### 2.2. HTML
207205
#### nodejs, dark theme, 80px
208206
```html
209-
<img src="https://deviconapi.vercel.app/?nodejs&theme=dark&size=80"/>
207+
<img src="https://deviconapi.vercel.app/nodejs?theme=dark&size=80"/>
210208
```
211209
#### go, 180px, #f0f
212210
```html
213-
<img src="https://deviconapi.vercel.app/?go&size=180&color=f0f"/>
211+
<img src="https://deviconapi.vercel.app/go?size=180&color=f0f"/>
214212
```
215213
#### go, original-wordmark, 180px
216214
```html
217-
<img src="https://deviconapi.vercel.app/?go&version=original-wordmark&size=180"/>
215+
<img src="https://deviconapi.vercel.app/go?version=original-wordmark&size=180"/>
218216
```
219217

220218
<div align="right">
@@ -224,13 +222,13 @@ https://deviconapi.vercel.app/?
224222

225223
### 2.3. Results
226224
#### nodejs, dark theme, 80px
227-
![nodejs](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
225+
![nodejs](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
228226

229227
#### go, 180px, #f0f
230-
![go](https://deviconapi.vercel.app/?go&size=180&color=f0f)
228+
![go](https://deviconapi.vercel.app/go?size=180&color=f0f)
231229

232230
#### go, original-wordmark, 180px
233-
![go](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
231+
![go](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
234232

235233
<div align="right">
236234

@@ -246,4 +244,4 @@ https://deviconapi.vercel.app/?
246244

247245
**Based in [Devicon](https://github.com/devicons/devicon) and powered by [Vercel](https://vercel.com/)**\
248246
**Made with ❤ by [Josélio Júnior (Lunatic Fox)](https://github.com/lunatic-fox)**
249-
</div>
247+
</div>

api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Query } from '../src/@builder';
99
import SVGBuilder from '../src';
1010

1111
module.exports = async (req: { query: Query }, res: VercelResponse) => {
12+
1213
SVGBuilder(req.query)
1314
.then(svg => {
1415
res.setHeader('Content-Type', 'image/svg+xml');

docs/ptbr/README.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<div align="center">
32

43
# Devicon API ![](https://deviconapi.vercel.app/?devicon&size=40)
@@ -37,13 +36,12 @@
3736
## 1. Visão geral
3837
&emsp;Use a URL base abaixo para acessar a API.
3938
```https
40-
https://deviconapi.vercel.app/?
39+
https://deviconapi.vercel.app/
4140
```
42-
> *Você pode usar `/api?` no lugar de `/?` ao final do link se desejar.*
4341

4442
<div align="center">
4543

46-
**Ao longo desta documentação esta URL base será referenciada como `<URL>/?`**
44+
**Ao longo desta documentação esta URL base será referenciada como `<URL>/`**
4745
</div>
4846

4947
[***Pular para exemplos >>***](#2-exemplos)
@@ -58,9 +56,9 @@ https://deviconapi.vercel.app/?
5856

5957
***Exemplo***
6058
```https
61-
<URL>/?csharp
62-
<URL>/?cplusplus
63-
<URL>/?javascript
59+
<URL>/csharp
60+
<URL>/cplusplus
61+
<URL>/javascript
6462
```
6563

6664
<div align="right">
@@ -85,16 +83,16 @@ https://deviconapi.vercel.app/?
8583
***Exemplo***
8684
```html
8785
<picture>
88-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
89-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
86+
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/devicon?theme=dark&size=50">
87+
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/devicon?theme=light&size=50">
9088
</picture>
9189
```
9290

9391
***Resultado***
9492
<div align="center">
9593
<picture>
96-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
97-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
94+
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/devicon?theme=dark&size=50">
95+
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/devicon?theme=light&size=50">
9896
</picture>
9997
</div>
10098

@@ -104,13 +102,13 @@ https://deviconapi.vercel.app/?
104102
***Exemplo usando `dark`***\
105103
&emsp;Ícone Next.js preenchido em `#ffffff`
106104
```https
107-
<URL>/?nextjs&theme=dark
105+
<URL>/nextjs?theme=dark
108106
```
109107

110108
***Exemplo usando `light`***\
111109
&emsp;Ícone Next.js preenchido em `#000000`
112110
```https
113-
<URL>/?nextjs&theme=light
111+
<URL>/nextjs?theme=light
114112
```
115113

116114
<div align="right">
@@ -131,13 +129,13 @@ https://deviconapi.vercel.app/?
131129
***Exemplo usando hexadecimal***\
132130
&emsp;Ícone JavaScript preenchido em `#ff5656`
133131
```https
134-
<URL>/?javascript&color=ff5656
132+
<URL>/javascript?color=ff5656
135133
```
136134

137135
***Exemplo usando cor CSS***\
138136
&emsp;Ícone JavaScript preenchido em `#ff0000`
139137
```https
140-
<URL>/?javascript&color=red
138+
<URL>/javascript?color=red
141139
```
142140

143141
<div align="right">
@@ -159,7 +157,7 @@ https://deviconapi.vercel.app/?
159157
***Exemplo usando `line`***\
160158
&emsp;Ícone Apache na versão `line` onde o padrão é `plain`.
161159
```https
162-
<URL>/?apache&version=line
160+
<URL>/apache?version=line
163161
```
164162

165163
<div align="right">
@@ -173,7 +171,7 @@ https://deviconapi.vercel.app/?
173171
***Exemplo usando 50px***\
174172
&emsp;Ícone Node.js em 50×50px.
175173
```https
176-
<URL>/?nodejs&size=50
174+
<URL>/nodejs?size=50
177175
```
178176

179177
<div align="right">
@@ -185,15 +183,15 @@ https://deviconapi.vercel.app/?
185183
### 2.1. Markdown
186184
#### nodejs, tema escuro, 80px
187185
```markdown
188-
![](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
186+
![](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
189187
```
190188
#### go, 180px, #f0f
191189
```markdown
192-
![](https://deviconapi.vercel.app/?go&size=180&color=f0f)
190+
![](https://deviconapi.vercel.app/go?size=180&color=f0f)
193191
```
194192
#### go, original-wordmark, 180px
195193
```markdown
196-
![](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
194+
![](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
197195
```
198196

199197
<div align="right">
@@ -204,15 +202,15 @@ https://deviconapi.vercel.app/?
204202
### 2.2. HTML
205203
#### nodejs, tema escuro, 80px
206204
```html
207-
<img src="https://deviconapi.vercel.app/?nodejs&theme=dark&size=80"/>
205+
<img src="https://deviconapi.vercel.app/nodejs?theme=dark&size=80"/>
208206
```
209207
#### go, 180px, #f0f
210208
```html
211-
<img src="https://deviconapi.vercel.app/?go&size=180&color=f0f"/>
209+
<img src="https://deviconapi.vercel.app/go?size=180&color=f0f"/>
212210
```
213211
#### go, original-wordmark, 180px
214212
```html
215-
<img src="https://deviconapi.vercel.app/?go&version=original-wordmark&size=180"/>
213+
<img src="https://deviconapi.vercel.app/go?version=original-wordmark&size=180"/>
216214
```
217215

218216
<div align="right">
@@ -222,13 +220,13 @@ https://deviconapi.vercel.app/?
222220

223221
### 2.3. Resultados
224222
#### nodejs, tema escuro, 80px
225-
![nodejs](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
223+
![nodejs](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
226224

227225
#### go, 180px, #f0f
228-
![go](https://deviconapi.vercel.app/?go&size=180&color=f0f)
226+
![go](https://deviconapi.vercel.app/go?size=180&color=f0f)
229227

230228
#### go, original-wordmark, 180px
231-
![go](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
229+
![go](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
232230

233231
<div align="right">
234232

@@ -244,4 +242,4 @@ https://deviconapi.vercel.app/?
244242

245243
**Baseado em [Devicon](https://github.com/devicons/devicon) e distribuído por [Vercel](https://vercel.com/)**\
246244
**Feito com ❤ por [Josélio Júnior (Lunatic Fox)](https://github.com/lunatic-fox)**
247-
</div>
245+
</div>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devicon-api",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "API to change colors and size of Devicon icons.",
55
"main": "index.ts",
66
"scripts": {},

public/favicon.ico

2.03 KB
Binary file not shown.

src/@builder/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type IconVersions =
1313
| 'line-wordmark';
1414

1515
export type Query = {
16+
icon?: string,
1617
color: string,
1718
theme: 'dark' | 'light',
1819
version: IconVersions,

src/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ const SVGBuilder = async (query: Query) => {
2323

2424
const iconsObj: IconsObj = JSON.parse(fs.readFileSync(path.join(__dirname, './data/index.json'), 'utf8'));
2525

26-
const iconName = Object.keys(query)
27-
.filter(e => ![
28-
'color',
29-
'theme',
30-
'version',
31-
'size'
32-
].some(f => e === f))[0];
26+
const iconName = query.icon ?
27+
query.icon
28+
: Object.keys(query)
29+
.filter(e => ![
30+
'icon',
31+
'color',
32+
'theme',
33+
'version',
34+
'size'
35+
].includes(e))[0];
3336

3437
if (iconsObj[iconName]) {
3538
const icon = versionPriority.includes(query.version) ?

0 commit comments

Comments
 (0)