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:
parent
93e971c34c
commit
4a7e650995
@ -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
Normal file
21
.build/preview-random-icons.mjs
Normal 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
1
.gitignore
vendored
@ -20,6 +20,7 @@ yarn.lock
|
||||
dist/
|
||||
_import.csv
|
||||
_import.tsv
|
||||
random-icons.svg
|
||||
|
||||
.yarn
|
||||
.yarnrc.yml
|
||||
|
Loading…
x
Reference in New Issue
Block a user