Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function fallbackAvatar(username) {
// Custom identicon style
// https://jdenticon.com/icon-designer.html?config=ffffffff01416400154b194b
jdenticon.config = {
lightness: {
color: [0.21, 0.75],
grayscale: [0.26, 0.75],
},
saturation: {
color: 1.00,
grayscale: 0.00,
},
backColor: "#ffffffff",
}
const identicon = window.encodeURIComponent(jdenticon.toSvg(md5(username), 100))
return `data:image/svg+xml;utf8,${identicon}`
}
return function(random: Random) {
jdenticon.config = {
hues: options.hues,
lightness: {
color: options.colorLightness,
grayscale: options.grayscaleLightness
},
saturation: {
color: options.colorSaturation,
grayscale: options.grayscaleSaturation
},
backColor: options.background
};
return jdenticon
.toSvg(random.seed, 50, options.padding || 0)
.replace('width="50"', '')
.replace('height="50"', '');