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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@littleeagle/images-node

v0.1.4

Published

Generate beautiful images on the fly

Downloads

3

Readme

Little Eagle logo

Little Eagle: Generate beautiful images on the fly.

Works with:

  • Remix
  • Next.js
  • Express

Get Started

npm add @littleeagle/images-node

Usage

As a GitHub User:

import { gitHubTemplateURL } from "@littleeagle/images-node";

const imageURL = gitHubTemplateURL({
  username: "BurntCaramel",
  backgroundColor: "#00b4ff",
  text: [
    { text: "First", size: 17, color: "#aaa" },
    { text: "Second", size: 23, color: "#bbb" },
  ],
  authorName: 'some-author',
  website: 'example.org',
});

// Use `imageURL` e.g. as the value in a `og:image` meta tag or src of an `<img>`.

transformColor option

import { gitHubTemplateURL } from "@littleeagle/images-node";

const imageURL = gitHubTemplateURL({
  username: "BurntCaramel",
  backgroundColor: "black",
  text: [
    { text: "First", size: 17, color: "red" },
    { text: "Second", size: 23, color: "red" },
  ],
  authorName: 'some-author',
  website: 'example.org',
}, {
  transformColor(input: string): string {
    switch (input) {
      case 'black': return '#000';
      case 'red': return '#f00';
      default: return input;
    }
  }
});

// Use `imageURL` e.g. as the value in a `og:image` meta tag or src of an `<img>`.

If you use Tailwind, you can use transformColor to transform say red-500 into the Tailwind color. Read out blog post on using Tailwind’s colors for more.

With a LittleEagle.io Project:

  1. Sign up to create a free account on littleeagle.io
  2. Find your project ID and secret in the Little Eagle dashboard. Set these as environment variables (suggested names: LITTLE_EAGLE_PROJECT_ID and LITTLE_EAGLE_PROJECT_SECRET).
  3. Install the Little Eagle node package: npm add @littleeagle/images-node
  4. Call the littleEagleImagesURL() function to generate your images URL. An example is provided below. It’s recommended you do this on the server as your secret shouldn’t be made public.
import { littleEagleImagesURL } from "@littleeagle/images-node";

const imageURL = littleEagleImagesURL({
  id: process.env.LITTLE_EAGLE_PROJECT_ID,
  secret: process.env.LITTLE_EAGLE_PROJECT_SECRET,
}, {
  template: "plain", // "plain" or "overlay" supported.
  // Any of the below options can be dynamic.
  // e.g. Load your text or image from your database or content management system!
  backgroundColor: "#00b4ff",
  imageURL:
    "https://images.unsplash.com/photo-1606890658317-7d14490b76fd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTJ8fHNuZWFrZXJ8ZW58MHx8MHx8&auto=format&fit=crop&w=600&q=60",
  text: [
    { text: "First", size: 17, color: "#aaa" },
    { text: "Second", size: 23, color: "#bbb" },
  ],
});

// Use `imageURL` e.g. as the value in a `og:image` meta tag.

Example