mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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
17 lines
503 B
TypeScript
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();
|