Browse Source

rendom icons generator

pull/912/head
codecalm 2 years ago
parent
commit
4a7e650995
  1. 8
      .build/helpers.mjs
  2. 21
      .build/preview-random-icons.mjs
  3. 1
      .gitignore

8
.build/helpers.mjs

@ -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)
}
}

21
.build/preview-random-icons.mjs

@ -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

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

Loading…
Cancel
Save