1
0
mirror of https://github.com/tabler/tabler-icons.git synced 2025-01-29 10:20:52 +01:00

rendom icons generator

This commit is contained in:
codecalm 2023-11-18 14:43:10 +01:00
parent 93e971c34c
commit 4a7e650995
3 changed files with 28 additions and 2 deletions

View File

@ -177,7 +177,8 @@ export const generateIconsPreview = async function(files, destFile, {
columnsCount = 19,
paddingOuter = 7,
color = '#354052',
background = '#fff'
background = '#fff',
png = true
} = {}) {
const padding = 20,
@ -218,7 +219,10 @@ export const generateIconsPreview = async function(files, destFile, {
const svgContent = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}" style="color: ${color}"><rect x="0" y="0" width="${width}" height="${height}" fill="${background}"></rect>\n${svgContentSymbols}\n${svgContentIcons}\n</svg>`
fs.writeFileSync(destFile, svgContent)
await createScreenshot(destFile)
if (png) {
await createScreenshot(destFile)
}
}

View File

@ -0,0 +1,21 @@
import glob from 'glob'
import { generateIconsPreview } from './helpers.mjs'
glob('icons/*.svg', {}, async function (er, files) {
files = files.filter(file =>
!file.endsWith('-filled.svg')
&& !file.endsWith('-off.svg')
&& !file.startsWith('icons/number-')
&& !file.startsWith('icons/letter-')
);
files = files.sort(() => Math.random() - 0.5)
files = files.slice(0, 500)
await generateIconsPreview(files, 'random-icons.svg', {
background: 'transparent',
columnsCount: 25,
png: false
})
})

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ yarn.lock
dist/
_import.csv
_import.tsv
random-icons.svg
.yarn
.yarnrc.yml