Skip to content

Commit 2a067c6

Browse files
authored
Merge pull request #4 from lunatic-fox/v1.1.0
v1.1.0
2 parents 42ea336 + 9704aeb commit 2a067c6

File tree

9 files changed

+72
-69
lines changed

9 files changed

+72
-69
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">
@@ -46,13 +45,12 @@ An interface page to select the icons.
4645
## 1. Overview
4746
&emsp;Use the base URL below to access the API.
4847
```https
49-
https://deviconapi.vercel.app/?
48+
https://deviconapi.vercel.app/
5049
```
51-
> *You can use `/api?` instead of `/?` at the end of the link if you want.*
5250

5351
<div align="center">
5452

55-
**Through this documentation this base URL will be referred as `<URL>/?`**
53+
**Through this documentation this base URL will be referred as `<URL>/`**
5654
</div>
5755

5856
[***Jump to examples >>***](#2-examples)
@@ -67,9 +65,9 @@ https://deviconapi.vercel.app/?
6765

6866
***Example***
6967
```https
70-
<URL>/?csharp
71-
<URL>/?cplusplus
72-
<URL>/?javascript
68+
<URL>/csharp
69+
<URL>/cplusplus
70+
<URL>/javascript
7371
```
7472

7573
<div align="right">
@@ -94,16 +92,16 @@ https://deviconapi.vercel.app/?
9492
***Example***
9593
```html
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
```
10199

102100
***Result***
103101
<div align="center">
104102
<picture>
105-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
106-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
103+
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/devicon?theme=dark&size=50">
104+
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/devicon?theme=light&size=50">
107105
</picture>
108106
</div>
109107

@@ -114,13 +112,13 @@ https://deviconapi.vercel.app/?
114112
***Example using `dark`***\
115113
&emsp;Next.js icon filled in `#ffffff`
116114
```https
117-
<URL>/?nextjs&theme=dark
115+
<URL>/nextjs?theme=dark
118116
```
119117

120118
***Example using `light`***\
121119
&emsp;Next.js icon filled in `#000000`
122120
```https
123-
<URL>/?nextjs&theme=light
121+
<URL>/nextjs?theme=light
124122
```
125123

126124
<div align="right">
@@ -141,13 +139,13 @@ https://deviconapi.vercel.app/?
141139
***Example using hexadecimal***\
142140
&emsp;JavaScript icon filled in `#ff5656`
143141
```https
144-
<URL>/?javascript&color=ff5656
142+
<URL>/javascript?color=ff5656
145143
```
146144

147145
***Example using CSS color***\
148146
&emsp;JavaScript icon filled in `#ff0000`
149147
```https
150-
<URL>/?javascript&color=red
148+
<URL>/javascript?color=red
151149
```
152150

153151
<div align="right">
@@ -169,7 +167,7 @@ https://deviconapi.vercel.app/?
169167
***Example using `line`***\
170168
&emsp;Apache icon in `line` version where default is `plain`.
171169
```https
172-
<URL>/?apache&version=line
170+
<URL>/apache?version=line
173171
```
174172

175173
<div align="right">
@@ -183,7 +181,7 @@ https://deviconapi.vercel.app/?
183181
***Example using 50px***\
184182
&emsp;Node.js icon in 50×50px.
185183
```https
186-
<URL>/?nodejs&size=50
184+
<URL>/nodejs?size=50
187185
```
188186

189187
<div align="right">
@@ -195,15 +193,15 @@ https://deviconapi.vercel.app/?
195193
### 2.1. Markdown
196194
#### nodejs, dark theme, 80px
197195
```markdown
198-
![](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
196+
![](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
199197
```
200198
#### go, 180px, #f0f
201199
```markdown
202-
![](https://deviconapi.vercel.app/?go&size=180&color=f0f)
200+
![](https://deviconapi.vercel.app/go?size=180&color=f0f)
203201
```
204202
#### go, original-wordmark, 180px
205203
```markdown
206-
![](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
204+
![](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
207205
```
208206

209207
<div align="right">
@@ -214,15 +212,15 @@ https://deviconapi.vercel.app/?
214212
### 2.2. HTML
215213
#### nodejs, dark theme, 80px
216214
```html
217-
<img src="https://deviconapi.vercel.app/?nodejs&theme=dark&size=80"/>
215+
<img src="https://deviconapi.vercel.app/nodejs?theme=dark&size=80"/>
218216
```
219217
#### go, 180px, #f0f
220218
```html
221-
<img src="https://deviconapi.vercel.app/?go&size=180&color=f0f"/>
219+
<img src="https://deviconapi.vercel.app/go?size=180&color=f0f"/>
222220
```
223221
#### go, original-wordmark, 180px
224222
```html
225-
<img src="https://deviconapi.vercel.app/?go&version=original-wordmark&size=180"/>
223+
<img src="https://deviconapi.vercel.app/go?version=original-wordmark&size=180"/>
226224
```
227225

228226
<div align="right">
@@ -232,13 +230,13 @@ https://deviconapi.vercel.app/?
232230

233231
### 2.3. Results
234232
#### nodejs, dark theme, 80px
235-
![nodejs](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
233+
![nodejs](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
236234

237235
#### go, 180px, #f0f
238-
![go](https://deviconapi.vercel.app/?go&size=180&color=f0f)
236+
![go](https://deviconapi.vercel.app/go?size=180&color=f0f)
239237

240238
#### go, original-wordmark, 180px
241-
![go](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
239+
![go](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
242240

243241
<div align="right">
244242

@@ -253,4 +251,4 @@ https://deviconapi.vercel.app/?
253251

254252
**Based in [Devicon](https://github.com/devicons/devicon) and powered by [Vercel](https://vercel.com/)**\
255253
**Made with ❤ by [Josélio Júnior (Lunatic Fox)](https://github.com/lunatic-fox)**
256-
</div>
254+
</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)
@@ -47,13 +46,12 @@ Uma página de interface para selecionar os ícones.
4746
## 1. Visão geral
4847
&emsp;Use a URL base abaixo para acessar a API.
4948
```https
50-
https://deviconapi.vercel.app/?
49+
https://deviconapi.vercel.app/
5150
```
52-
> *Você pode usar `/api?` no lugar de `/?` ao final do link se desejar.*
5351

5452
<div align="center">
5553

56-
**Ao longo desta documentação esta URL base será referenciada como `<URL>/?`**
54+
**Ao longo desta documentação esta URL base será referenciada como `<URL>/`**
5755
</div>
5856

5957
[***Pular para exemplos >>***](#2-exemplos)
@@ -68,9 +66,9 @@ https://deviconapi.vercel.app/?
6866

6967
***Exemplo***
7068
```https
71-
<URL>/?csharp
72-
<URL>/?cplusplus
73-
<URL>/?javascript
69+
<URL>/csharp
70+
<URL>/cplusplus
71+
<URL>/javascript
7472
```
7573

7674
<div align="right">
@@ -95,16 +93,16 @@ https://deviconapi.vercel.app/?
9593
***Exemplo***
9694
```html
9795
<picture>
98-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
99-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
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">
10098
</picture>
10199
```
102100

103101
***Resultado***
104102
<div align="center">
105103
<picture>
106-
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/?devicon&theme=dark&size=50">
107-
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/?devicon&theme=light&size=50">
104+
<source media="(prefers-color-scheme: dark)" srcset="https://deviconapi.vercel.app/devicon?theme=dark&size=50">
105+
<img alt="Devicon" title="Devicon" src="https://deviconapi.vercel.app/devicon?theme=light&size=50">
108106
</picture>
109107
</div>
110108

@@ -114,13 +112,13 @@ https://deviconapi.vercel.app/?
114112
***Exemplo usando `dark`***\
115113
&emsp;Ícone Next.js preenchido em `#ffffff`
116114
```https
117-
<URL>/?nextjs&theme=dark
115+
<URL>/nextjs?theme=dark
118116
```
119117

120118
***Exemplo usando `light`***\
121119
&emsp;Ícone Next.js preenchido em `#000000`
122120
```https
123-
<URL>/?nextjs&theme=light
121+
<URL>/nextjs?theme=light
124122
```
125123

126124
<div align="right">
@@ -141,13 +139,13 @@ https://deviconapi.vercel.app/?
141139
***Exemplo usando hexadecimal***\
142140
&emsp;Ícone JavaScript preenchido em `#ff5656`
143141
```https
144-
<URL>/?javascript&color=ff5656
142+
<URL>/javascript?color=ff5656
145143
```
146144

147145
***Exemplo usando cor CSS***\
148146
&emsp;Ícone JavaScript preenchido em `#ff0000`
149147
```https
150-
<URL>/?javascript&color=red
148+
<URL>/javascript?color=red
151149
```
152150

153151
<div align="right">
@@ -169,7 +167,7 @@ https://deviconapi.vercel.app/?
169167
***Exemplo usando `line`***\
170168
&emsp;Ícone Apache na versão `line` onde o padrão é `plain`.
171169
```https
172-
<URL>/?apache&version=line
170+
<URL>/apache?version=line
173171
```
174172

175173
<div align="right">
@@ -183,7 +181,7 @@ https://deviconapi.vercel.app/?
183181
***Exemplo usando 50px***\
184182
&emsp;Ícone Node.js em 50×50px.
185183
```https
186-
<URL>/?nodejs&size=50
184+
<URL>/nodejs?size=50
187185
```
188186

189187
<div align="right">
@@ -195,15 +193,15 @@ https://deviconapi.vercel.app/?
195193
### 2.1. Markdown
196194
#### nodejs, tema escuro, 80px
197195
```markdown
198-
![](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
196+
![](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
199197
```
200198
#### go, 180px, #f0f
201199
```markdown
202-
![](https://deviconapi.vercel.app/?go&size=180&color=f0f)
200+
![](https://deviconapi.vercel.app/go?size=180&color=f0f)
203201
```
204202
#### go, original-wordmark, 180px
205203
```markdown
206-
![](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
204+
![](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
207205
```
208206

209207
<div align="right">
@@ -214,15 +212,15 @@ https://deviconapi.vercel.app/?
214212
### 2.2. HTML
215213
#### nodejs, tema escuro, 80px
216214
```html
217-
<img src="https://deviconapi.vercel.app/?nodejs&theme=dark&size=80"/>
215+
<img src="https://deviconapi.vercel.app/nodejs?theme=dark&size=80"/>
218216
```
219217
#### go, 180px, #f0f
220218
```html
221-
<img src="https://deviconapi.vercel.app/?go&size=180&color=f0f"/>
219+
<img src="https://deviconapi.vercel.app/go?size=180&color=f0f"/>
222220
```
223221
#### go, original-wordmark, 180px
224222
```html
225-
<img src="https://deviconapi.vercel.app/?go&version=original-wordmark&size=180"/>
223+
<img src="https://deviconapi.vercel.app/go?version=original-wordmark&size=180"/>
226224
```
227225

228226
<div align="right">
@@ -232,13 +230,13 @@ https://deviconapi.vercel.app/?
232230

233231
### 2.3. Resultados
234232
#### nodejs, tema escuro, 80px
235-
![nodejs](https://deviconapi.vercel.app/?nodejs&theme=dark&size=80)
233+
![nodejs](https://deviconapi.vercel.app/nodejs?theme=dark&size=80)
236234

237235
#### go, 180px, #f0f
238-
![go](https://deviconapi.vercel.app/?go&size=180&color=f0f)
236+
![go](https://deviconapi.vercel.app/go?size=180&color=f0f)
239237

240238
#### go, original-wordmark, 180px
241-
![go](https://deviconapi.vercel.app/?go&version=original-wordmark&size=180)
239+
![go](https://deviconapi.vercel.app/go?version=original-wordmark&size=180)
242240

243241
<div align="right">
244242

@@ -253,4 +251,4 @@ https://deviconapi.vercel.app/?
253251

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

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)