npm.io
1.0.12 • Published 4 years ago

gravatar-url-simple

Licence
MIT
Version
1.0.12
Deps
0
Size
18 kB
Vulns
0
Weekly
0

Gravatar

npm NPM downloads License

Simple, lightweight npm package without external dependencies

Install

npm i gravatar-url-simple

Import

import { gravatarURL } from "gravatar-url-simple";

Simple usage:

const email = "test@email.com"
const defaultImage = gravatarURL.gravatarTypes.IDENTICON
gravatarURL.getGravatarUrl(email, defaultImage)
Default inage types:
const gravatarTypes = {
  NOTFOUND: "404",
  MP: "mp",
  IDENTICON: "identicon",
  MONSTERID: "monsterid",
  WAVATAR: "wavatar",
  RETRO: "retro",
  ROBOHASH: "robohash",
  BLANK: "blank",
};

404: do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response

mp: (mystery-person) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)

identicon: a geometric pattern based on an email hash

monsterid: a generated 'monster' with different colors, faces, etc

wavatar: generated faces with differing features and backgrounds

retro: awesome generated, 8-bit arcade-style pixelated faces

robohash: a generated robot with different colors, faces, etc

blank: a transparent PNG image (border added to HTML below for demonstration purposes)