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

@sprig-and-prose/sprig-texture

v0.1.0

Published

Procedurally generated, calm background textures

Readme

sprig-texture

Procedurally generated, calm, parasympathetic background textures for use across projects.

Purpose

This library generates seamless, tiling textures designed to:

  • Eliminate gradient banding and grid artifacts
  • Provide subtle "paper / watercolor surface" material
  • Create calm, non-distracting backgrounds
  • Be deterministic (same key = same texture)

Important: This library generates neutral material textures. Lighting, vignettes, and mood gradients belong in CSS, not in the texture bitmap.

Usage

import { generateTexture, releaseObjectUrl, nightInk, bloom } from 'sprig-texture';

const { canvas, blob, url } = await generateTexture({
  key: 'my-unique-key',
  palette: nightInk,
  preset: bloom,
});

// Use the URL as a background image
element.style.backgroundImage = `url(${url})`;
element.style.backgroundRepeat = 'repeat';
element.style.backgroundSize = '1024px 1024px';

// Clean up when done (prevents memory leaks)
releaseObjectUrl(url);

Determinism

Textures are deterministic: the same key + palette + preset will always produce the same texture. This allows caching and consistent rendering across sessions.

Palettes

  • nightInk: Dark blue-gray tones (default)
  • parchment: Warm paper tones

Presets

  • quiet: Minimal variation, subtle
  • bloom: Slightly richer, more variation (default)

Watercolor Stroke CSS

This package includes a reusable CSS module for creating watercolor brush stroke effects, perfect for highlighting keywords, badges, or decorative elements.

Importing the CSS

/* In your CSS file */
@import 'sprig-texture/src/styles/watercolor-stroke.css';

Or in JavaScript/TypeScript (if your bundler supports CSS imports):

import 'sprig-texture/src/styles/watercolor-stroke.css';

Basic Usage

Apply the .watercolor-stroke class to an element and set CSS variables for color and opacity:

<span class="watercolor-stroke" style="--watercolor-pigment-color: rgba(50, 80, 160, 1); --watercolor-opacity: 0.30;">
  COLLECTS
</span>

The effect is applied via a ::before pseudo-element, so ensure your element has position: relative:

.my-badge {
  position: relative;
  display: inline-block;
  padding: 0.1rem 0.45rem;
}

Using Pre-configured Variants

The CSS includes several pre-configured color variants that you can use via data attributes:

<span class="watercolor-stroke" data-variant="collects">COLLECTS</span>
<span class="watercolor-stroke" data-variant="expands">EXPANDS</span>
<span class="watercolor-stroke" data-variant="optional">OPTIONAL</span>
<span class="watercolor-stroke" data-variant="aggregates">AGGREGATES</span>

Customizing Colors

Override the CSS variables to use your own colors:

.custom-stroke {
  --watercolor-pigment-color: rgba(120, 60, 200, 1);
  --watercolor-opacity: 0.35;
}

Adjusting Stroke Position

The stroke position is controlled by four CSS properties on the ::before pseudo-element. To adjust the position, override these values:

.my-element::before {
  top: -1.2rem;      /* move stroke DOWN = make this LESS negative */
  bottom: -0.54rem;   /* move stroke UP   = make this MORE negative */
  left: -0.80rem;
  right: -0.80rem;
}

How It Works

The watercolor effect is created using:

  • Radial gradients for the pigment color distribution
  • Clip-path polygon for the wavy brush stroke shape
  • Blur filter for soft edges
  • Mix-blend-mode: screen for the watercolor blending effect
  • Subtle transforms (rotate, skew) for natural variation

Design Principles

  1. Texture ≠ lighting: The generated bitmap is neutral material; CSS handles mood
  2. Micro-variation prevents banding: Multi-scale noise (low, mid, high frequency)
  3. Subtlety over effect: Everything should be "barely there"
  4. Forgiving defaults: generateTexture({ key }) should look good

Layers

The texture is generated in 5 layers:

  1. Base fill: Palette-driven base color
  2. Ultra-low-frequency tone drift: Very large radial washes to prevent flat regions
  3. Mid-frequency mottling: Soft radial blobs for material variation
  4. Paper grain / speckles: Soft dots for texture and anti-banding
  5. Fiber strokes: Thin strokes with vertical bias

All layers tile seamlessly.

API

generateTexture(args)

Generates a texture and returns a Promise resolving to { canvas, blob, url }.

  • args.key (string, required): Deterministic seed key
  • args.size (number, optional, default: 1024): Canvas size (square)
  • args.palette (Palette, optional): Color palette (default: nightInk)
  • args.preset (Preset, optional): Numeric parameters (default: bloom)

releaseObjectUrl(url)

Releases an object URL created by generateTexture(). Call this when you're done using the texture to prevent memory leaks in long-running sessions.

Examples

See examples/demo.html for a working demo with controls.

To run the demo, start a local server:

npm run serve

Then open http://localhost:3000/examples/demo.html in your browser.

Alternatively, you can use any static file server:

  • npx serve . (if you have serve installed)
  • python3 -m http.server 8000 (Python 3)
  • Or any other static file server