DefinitelyTyped/types/identicon.js/identicon.js-tests.ts
Dominik H ec6e825ec9 Added types for identicon.js (#34286)
* added identicon.js types

* instead of exporting the PNGlib and Svg class they are now declared

* instead of classes interfaces are now used for PNGlib and Svg
2019-03-29 17:28:47 -07:00

17 lines
503 B
TypeScript

import Identicon, { Svg } from "identicon.js";
// create an identicon with only a hash and a size
new Identicon("d3b07384d113edec49eaa6238ad5ff00", 420).toString();
// create an identicon with a hash and other options and get the svg
const svg = new Identicon("d3b07384d113edec49eaa6238ad5ff00", {
background: [255, 255, 255, 255],
foreground: [0, 0, 0, 0],
margin: 0.05,
size: 64,
format: "svg",
}).image() as Svg;
svg.getDump();
// or get the base64 encoded svg
svg.getBase64();