0.1.3 • Published 4 years ago
terrazzo-maker v0.1.3
Description
terrazzo-maker
is a dummy terrazzo pattern generator written in Typescript, and it's empowered by D3. You can utilize it to creae a SVG element and embed it to your page. Or, just generate it in base64 string and use it as source of background image. Hope it helps. 🦊
Install
npm i terrazzo-maker
Run example up
Default web server port is 9000
, and you can change it in package.json
.
npm run example
Then, check it by viewing http://localhost:9000
.
Usage
To make a terrazzo SVG:
import { makeSVG, makeSVGBase64 } from 'terrazzo-maker'
const svg = makeSVG({
blob: { min: 5, max: 20 },
colors: [
'#EFE1F0',
'#CCEAF0',
...
],
density: 300,
terrazzo: {
backgroundColor: '#FFFFFF',
height: 500,
width: 500
}
})
To convert a SVG into base64 string:
const base64 = makeSVGBase64(svg.node())