npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

astro-gravatar

v0.0.1

Published

Astro components for integrating Gravatar avatars and profiles

Downloads

101

Readme

astro-gravatar

npm version License: MIT

Astro components for integrating Gravatar avatars and profiles into your Astro site.

✨ Features

  • 🎨 Beautiful Components - Ready-to-use avatar and profile card components
  • 🚀 Performance Optimized - Built-in caching, lazy loading, and image optimization
  • 🔒 TypeScript Support - Full type safety with comprehensive interfaces
  • 🎭 Customizable - Extensive styling and layout options
  • 📱 Responsive - Mobile-friendly with accessibility features
  • 🌐 SSR Compatible - Works seamlessly with Astro's server-side rendering

🚀 Quick Start

Installation

bun add astro-gravatar

Basic Usage

---
import GravatarAvatar from 'astro-gravatar';
---

<GravatarAvatar email="[email protected]" size={120} />

Profile Cards

---
import GravatarProfileCard from 'astro-gravatar/GravatarProfileCard';
---

<GravatarProfileCard
  email="[email protected]"
  layout="card"
  showVerified
  showLinks
/>

QR Codes

---
import GravatarQR from 'astro-gravatar/GravatarQR';
---

<GravatarQR
  email="[email protected]"
  size={150}
  version={3}
  type="gravatar"
  utmMedium="web"
  utmCampaign="profile_share"
/>

📖 Documentation

🎯 Components

GravatarAvatar

Display a Gravatar avatar with extensive customization:

<GravatarAvatar
  email="[email protected]"
  size={150}
  rating="pg"
  default="identicon"
  class="rounded-full"
  lazy={true}
/>

GravatarProfileCard

Display a complete profile card with avatar and user information:

<GravatarProfileCard
  email="[email protected]"
  layout="horizontal"
  avatarSize={100}
  showName
  showBio
  showVerified
/>

GravatarQR

Display a QR code that links to a user's Gravatar profile:

<GravatarQR
  email="[email protected]"
  size={150}
  version={3}
  type="gravatar"
  utmMedium="web"
  utmCampaign="profile_share"
  class="qr-code"
/>

🛠️ Utilities

Access the underlying utilities for custom implementations:

---
import { buildAvatarUrl, buildQRCodeUrl, getProfile } from 'astro-gravatar';

// Build custom avatar URL
const avatarUrl = buildAvatarUrl('[email protected]', { size: 200 });

// Build QR code URL
const qrUrl = buildQRCodeUrl('[email protected]', { size: 150, version: 3 });

// Fetch profile data
const profile = await getProfile('[email protected]');
---

<img src={avatarUrl} alt="User Avatar" />
<img src={qrUrl} alt="QR Code" />
<h1>{profile.display_name}</h1>

🎨 Styling

Components include sensible defaults but are fully customizable:

/* Custom avatar styling */
.my-avatar {
  border-radius: 50%;
  border: 3px solid #3b82f6;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.my-avatar:hover {
  transform: scale(1.05);
}

🔧 Configuration

All components support extensive configuration options:

Avatar Options

  • size - Avatar size in pixels (1-2048)
  • rating - Content rating level (g, pg, r, x)
  • default - Default image for missing avatars
  • lazy - Enable lazy loading

Profile Card Options

  • layout - Layout style (horizontal, vertical, card)
  • template - Content template (default, compact, detailed)
  • showName, showBio, showVerified, showLinks - Toggle content sections

QR Code Options

  • size - QR code size in pixels (1-1000, default: 80)
  • version - QR code style version (1: standard, 3: modern dots)
  • type - Center icon type (user, gravatar, none)
  • utmMedium - UTM medium parameter for tracking
  • utmCampaign - UTM campaign parameter for tracking

📝 TypeScript Support

Full TypeScript support with comprehensive types:

import type { GravatarProfile, GravatarAvatarProps } from 'astro-gravatar';

// Use types in your components
const profile: GravatarProfile = await getProfile('[email protected]');

🚀 Performance Features

  • Built-in Caching - Reduces API calls and improves performance
  • Lazy Loading - Images load only when needed
  • Responsive Images - Automatic srcset generation
  • Optimized URLs - Efficient Gravatar URL construction

🌍 Browser Support

  • Modern browsers with ES6 module support
  • Progressive enhancement for JavaScript-disabled environments
  • Responsive design with accessibility features

🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action | | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | bun link | Registers this package locally. Run bun link astro-gravatar in an Astro project to install your components | | bun publish | Publishes this package to NPM. Requires you to be logged in | | bun run typecheck | Check TypeScript types without building |

📄 License

MIT

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines for details.

🙏 Acknowledgments

  • Gravatar for the avatar service
  • Astro for the amazing framework
  • The community for feedback and support