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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gradient-gl

v2.3.0

Published

Tiny WebGL library for procedural gradient animations. Deterministic. Seed-driven.

Readme



SeedScript

One script tag:

<script type="module" src="https://unpkg.com/gradient-gl?seed=c1.eba9"></script>

read more


Usage

npm install gradient-gl
import gradientGL from "gradient-gl";

// Mounts to <body>
gradientGL("c1.eba9");

// Mounts inside #app
gradientGL("c1.eba9", "#app");

// Uses <canvas id="gradient">
gradientGL("c1.eba9", "canvas#gradient");

// Returns the program
const program = await gradientGL("c1.eba9");

Mounting Behavior

  • No selector: creates and styles a <canvas> in <body>
  • Selector to an element: creates and styles a <canvas> inside it
  • Selector to a <canvas>: uses that canvas. A sized canvas is left alone. An unsized one gets width and height of 100%.

Styles are overridable. Defaults are inline, so override them with !important.

Cleanup

Await initialization and destroy the program when its page or component unmounts:

const program = await gradientGL("c1.915c", "#meeting-gradient");

// Call from your unmount cleanup
program.destroy();

Only one program is active at a time. Calls with the same shader reuse it only while it is alive and mounted to the requested target. After cleanup or target replacement, the next call creates a new program. Library-created canvases are removed on cleanup; caller-provided canvases stay in the DOM and can be reused. If unmount happens before initialization resolves, destroy the returned program when the promise settles.

Stacking and Blend

Default canvas style: z-index: -1, no mix-blend-mode.

An opaque html/body background covers a -1 canvas. Raise z-index for fixed chrome or stacking contexts that sit above it. Set mix-blend-mode when the gradient should grade against page content.

#gradient-gl {
    z-index: 0 !important;
    mix-blend-mode: color !important;
}

Defaults are inline. A normal rule does not override them. Use !important.

Vite Configuration

export default {
    build: {
        target: "esnext",
    },
};

CDN

UNPKG

<script type="module">
    import gradientGL from "https://unpkg.com/gradient-gl";
    gradientGL("c1.eba9");
</script>

ESM

<script type="module">
    import gradientGL from "https://esm.sh/gradient-gl";
    gradientGL("c1.eba9");
</script>

SeedScript Usage

<!-- latest, mounts on body -->
<script type="module" src="https://unpkg.com/gradient-gl?seed=c1.eba9"></script>

<!-- pin a version -->
<script
    type="module"
    src="https://unpkg.com/[email protected]?seed=c1.eba9"
></script>

<!-- mount inside <main> -->
<script
    type="module"
    src="https://unpkg.com/gradient-gl?seed=c1.eba9&selector=main"
></script>

<!-- any CSS selector works -->
<script
    type="module"
    src="https://unpkg.com/gradient-gl?seed=c1.eba9&selector=.wrapper>.content"
></script>

<!-- # must be escaped: #app → %23app -->
<script
    type="module"
    src="https://unpkg.com/gradient-gl?seed=c1.eba9&selector=%23app"
></script>

Seed Format

{shader}.{speed}{hue}{sat}{light}

  • Shader: [a-z][0-9] (e.g., c1, n3)
  • Options: [0-9a-f] (hex values)

Explore and generate seeds in the playground

Shaders

IDs are alphabetical. Import the live list with import { shaderIds } from 'gradient-gl'.

| Series | IDs | Character | | ------ | ------------------- | ------------------------ | | b | b1 b2 b3 b4 | classic layered / radial | | c | c1 c4 | contrast duotone flow | | f | f1 f3 | fluid RGB noise | | l | l1 l3 l5 | liquid warp | | n | n1 n2 n3 n4 | noisy color islands | | s | s1 s3 | soft shade blobs |

n1/n2 are softer blends; n3/n4 are sharper islands.

Performance

Animated gradient background techniques, slowest to fastest:

  1. SVG: CPU-only, DOM-heavy, poor scaling, high memory
  2. Canvas 2D: CPU-only, main-thread load, imperative updates
  3. CSS: GPU-composited, limited complexity, best for static work
  4. WebGL: GPU shaders, wide support
  5. WebGPU: faster where available, thinner browser support

[!NOTE] WebGPU is faster where it runs. WebGL covers more browsers and is enough for animated gradients.

TODO: Interactive benchmark app


latest release

License

MIT