Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 1.6 KB

README.md

File metadata and controls

60 lines (47 loc) · 1.6 KB

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 image 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)