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

@effective/shadow

v2.0.3

Published

<p align="center"> <img src="images/default-shadows.png" alt="Shadow elevation examples" style="border:1px solid #555"/> </p>

Readme

Effective Shadow


The Problem with CSS Shadows

Most shadow implementations — including popular frameworks — share the same issues:

  1. Single-layer shadows look flat. A shadow with one uniform blur doesn't match how light behaves in the real world.

  2. Values are often arbitrary. Teams copy values from Stack Overflow or tweak numbers until "it looks okay". There's no underlying system.

  3. box-shadow and drop-shadow don't match. They use different blur algorithms (box vs. Gaussian), so the same values produce different results. Most developers don't even know this.

  4. Scaling is inconsistent. Going from "small" to "large" shadows often means arbitrary jumps rather than a harmonious progression.


Our Approach: Calculated, Not Guessed

Effective Shadow doesn't just provide presets — it's a calculation engine based on real principles:

Bézier-Curved Layer Distribution

Instead of linear steps, we use Bézier curves to distribute shadow layers. This creates the smooth falloff you see in natural shadows: sharper near the object, softer further away.

Layer 1: ░░░░░░░░░░  (subtle, close to element)
Layer 2: ░░░░░░░░    (medium distance)
Layer 3: ░░░░░░      (stronger)
Layer 4: ░░░░        (deepest, most diffuse)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Combined: Natural shadow with realistic depth

Harmonic Progression

Each elevation level follows a mathematical progression (~1.5-2× the previous), not arbitrary jumps:

| Level | Name | Offset | Blur | Layers | | ----- | -------- | ------ | ---- | ------ | | 1 | Subtle | 1px | 2px | 3 | | 2 | Low | 2px | 4px | 3 | | 3 | Raised | 3px | 6px | 4 | | 4 | Floating | 5px | 10px | 4 | | 5 | Overlay | 8px | 16px | 5 | | 6 | Modal | 14px | 28px | 6 | | 7 | Peak | 24px | 48px | 7 |

Calibrated Cross-Technique Output

box-shadow and filter: drop-shadow() render differently — box blur vs. Gaussian blur, linear vs. exponential stacking. We apply mathematically derived modifiers so both techniques produce consistent visual results from the same input parameters.


Use as Presets or as a Tool

Ready-to-Use Presets

npm install @effective/shadow
import "@effective/shadow/shadows.css"

<div className="shadow-4">Elevated card</div>
<img className="drop-shadow-4" src="icon.svg" />

Tailwind Plugin

// tailwind.config.js
import effectiveShadow from "@effective/shadow/tailwind"

export default {
  plugins: [effectiveShadow]
}

Build Your Own System

The real power is the calculation engine. Define your own elevation scale:

import { buildShadow, toBoxShadow, toDropShadow } from "@effective/shadow"

// Your custom configuration
const shadow = buildShadow({
  shadowLayers: 5,
  finalOffsetY: 12,
  finalBlur: 24,
  finalAlpha: 0.15,
  // Bézier curves for distribution
  offsetEasing: [0.4, 0, 0.2, 1],
  blurEasing: [0.4, 0, 0.2, 1],
  alphaEasing: [0.2, 0.5, 0.8, 0.5]
})

// Works for both shadow types
element.style.boxShadow = toBoxShadow(shadow)
element.style.filter = toDropShadow(shadow) // Automatically calibrated

→ Experiment in the interactive playground


Compared to Other Systems

We've analyzed the shadow implementations of major design systems:

| | Effective | Tailwind | Material 3 | Radix | | --------------------- | --------- | -------- | ---------- | ------ | | Layers | 3-7 | 1-2 | 3 | 1-2 | | Distribution | Bézier | Linear | Stepped | Linear | | Calculation basis | Formula | Manual | Spec-based | Manual | | Customizable | Full API | Config | Tokens | CSS |

→ Visual side-by-side comparison


Box Shadow vs Drop Shadow

Both have their place:

| | box-shadow | drop-shadow | | --------------------- | -------------------------- | --------------------------------------- | | Shape | Rectangular bounding box | Follows actual element contours | | Best for | Cards, buttons, containers | Icons, SVGs, transparent images | | Text shadows | Not applicable | Works on text glyphs directly | | Combined elements | Shadow around container | Unified shadow around all visible parts | | Performance | CPU-rendered | GPU-accelerated |

drop-shadow is particularly useful for text and icon+text combinations where you want a single unified shadow rather than a box around the container.

→ Interactive demo comparing both


Colored Shadows

Create eye-catching CTAs with colored shadows:

import { buildShadow, toBoxShadow } from "@effective/shadow"

const shadow = buildShadow({
  shadowLayers: 4,
  finalOffsetY: 12,
  finalBlur: 24,
  finalAlpha: 0.5
})

// Indigo glow effect
const ctaShadow = toBoxShadow(shadow, 3, { color: "99, 102, 241" })

Technical Foundation

The library is built on research from:


Contributing

git clone https://github.com/sebastian-software/effective-shadow.git
cd effective-shadow
pnpm install
pnpm dev      # Start demo
pnpm test     # Run tests
pnpm build    # Build library

See CONTRIBUTING.md for guidelines.


License

Apache License 2.0 — Free for personal and commercial use.