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

rgb-split-image

v1.0.0

Published

A highly customizable React component for creating event-driven chromatic aberration effects.

Readme

rgb-split-image

A lightweight React component for adding interactive RGB split (chromatic aberration) effects to images.

  • Zero dependencies
  • SSR-safe
  • Fully typed with strict TypeScript support
  • React only (Works with Next.js, Remix, React,Gatsby )

⚠️ Epilepsy Warning:

try not to get a seizure while using this component.

Install

npm install rgb-split-image

Quick Start

import { RGBSplitImage } from "rgb-split-image";

<RGBSplitImage
  src="/hero.jpg"
  alt="Hero"
  idleEffect="breathe"
  splitDistance={10}
/>;

Drop it in, pick an effect, and you’re good to go.


Available Effects

| Effect | What it does | | ------------- | ----------------------------------------- | | none | No channel split everything stays aligned | | breathe | Subtle, looping sine-wave motion | | followMouse | Channels shift toward the cursor | | glitch | Fast, random displacement each frame |


Triggers

Effects can run in different states:

| Prop | When it runs | | ------------ | ----------------------------------------------- | | idleEffect | Default state (always active unless overridden) | | onHover | While hovering the image | | onClick | Once per click, for effectDuration ms | | onMount | Once when the component mounts |

Priority order: onClick / onMountonHoveridleEffect

Higher-priority effects temporarily override lower ones.


Props

| Prop | Type | Default | Description | | ------------------ | ------------------- | -------- | --------------------------------------------------- | | src | string | - | Image URL | | alt | string | - | Alt text (required for accessibility) | | idleEffect | RGBEffect | "none" | Default effect | | onHover | RGBEffect | "none" | Effect on hover | | onClick | RGBEffect | "none" | Effect on click | | onMount | RGBEffect | - | Effect on mount | | splitDistance | number | 40 | Max pixel distance channels can separate | | effectDuration | number | 1000 | Duration of temporary effects (ms) | | effectIntensity | number | 1.5 | Multiplier for temporary effects | | breatheSpeed | number | 1.0 | Speed of the breathe animation | | colorSpace | "rgb" \| "cmyk" | "rgb" | Color matrix mode | | grayscale | boolean | false | Desaturates the base image | | trackWindowMouse | boolean | false | Track cursor outside the image bounds | | disableOnMobile | boolean | false | Disable effects on viewports ≤ 768px | | as | ElementType | "img" | Render as a custom component (e.g. Next.js Image) | | onImageClick | MouseEventHandler | — | Native click handler |

Type Safety

Some props (like breatheSpeed, effectDuration, effectIntensity, and trackWindowMouse) are conditionally typed.

If you pass them without activating the relevant effect, TypeScript will throw an error. No silent misconfiguration.


Examples

Breathe by default, glitch on click

<RGBSplitImage
  src="/photo.jpg"
  idleEffect="breathe"
  breatheSpeed={0.75}
  onClick="glitch"
  effectDuration={400}
  effectIntensity={1}
  splitDistance={20}
/>

Grayscale base with color following the cursor

<RGBSplitImage
  src="/landscape.jpg"
  idleEffect="followMouse"
  grayscale
  splitDistance={15}
/>

Track mouse across the whole window

<RGBSplitImage
  src="/grid.jpg"
  idleEffect="followMouse"
  trackWindowMouse
  splitDistance={20}
/>

Accessibility

  • Automatically respects prefers-reduced-motion
  • Pauses when out of view (via IntersectionObserver)
  • Optional disableOnMobile to reduce battery usage
  • Duplicate channel layers are marked aria-hidden="true"

License

MIT Jafar Sabaouni