glevatar
Easily create Gravatar URLs in Gleam.
Types
This type is employed when the provided email address does not correspond to any Gravatar image.
pub type DefaultImage {
NotFound
MysteryPerson
Identicon
MonsterId
Wavatar
Retro
Robohash
Blank
CustomImage(String)
}
Constructors
-
NotFoundSignifies that no image should be loaded.
-
MysteryPersonRepresents a simple, cartoon-style silhouetted outline of a person.
-
IdenticonDepicts a geometric pattern based on an email hash.
-
MonsterIdDenotes a generated “monster” with various colours and facial features.
-
WavatarRepresents generated faces with distinct features and backgrounds.
-
RetroDisplays artistically generated, 8-bit arcade-style pixelated faces.
-
RobohashSignifies a generated robot with different colours, faces, and so on.
-
BlankDenotes a transparent PNG image.
-
CustomImage(String)Indicates a custom default image fetched from a URL.
This type defines a Gravatar builder, which should not be manually modified.
pub type GravatarBuilder =
#(String, dict.Dict(String, String))
This type is used for specifying image ratings.
pub type ImageRating {
General
Parental
Restricted
Adult
}
Constructors
-
GeneralSuitable for display on all websites.
-
ParentalMay contain mild elements such as rude gestures, provocatively dressed individuals, or mild violence.
-
RestrictedMay contain stronger elements such as harsh profanity, intense violence, nudity, or hard drug use.
-
AdultMay contain explicit content, including hardcore sexual imagery or extremely disturbing violence.
Functions
pub fn new(email: String) -> #(String, Dict(String, String))
Create a new GravatarBuilder based on an email address.
pub fn set_default_image(
builder: #(String, Dict(String, String)),
default: DefaultImage,
) -> #(String, Dict(String, String))
Set the default image to be used when the provided email address doesn’t match any image.
pub fn set_rating(
builder: #(String, Dict(String, String)),
rating: ImageRating,
) -> #(String, Dict(String, String))
Set image rating restrictions.
pub fn set_size(
builder: #(String, Dict(String, String)),
size: Int,
) -> #(String, Dict(String, String))
Set a specific image size; the default is 80.
pub fn to_string(
builder: #(String, Dict(String, String)),
) -> String
Convert the GravatarBuilder into a Gravatar image URL.