New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rgb-split-image

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rgb-split-image

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

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

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

EffectWhat it does
noneNo channel split everything stays aligned
breatheSubtle, looping sine-wave motion
followMouseChannels shift toward the cursor
glitchFast, random displacement each frame

Triggers

Effects can run in different states:

PropWhen it runs
idleEffectDefault state (always active unless overridden)
onHoverWhile hovering the image
onClickOnce per click, for effectDuration ms
onMountOnce when the component mounts

Priority order: onClick / onMountonHoveridleEffect

Higher-priority effects temporarily override lower ones.

Props

PropTypeDefaultDescription
srcstring-Image URL
altstring-Alt text (required for accessibility)
idleEffectRGBEffect"none"Default effect
onHoverRGBEffect"none"Effect on hover
onClickRGBEffect"none"Effect on click
onMountRGBEffect-Effect on mount
splitDistancenumber40Max pixel distance channels can separate
effectDurationnumber1000Duration of temporary effects (ms)
effectIntensitynumber1.5Multiplier for temporary effects
breatheSpeednumber1.0Speed of the breathe animation
colorSpace"rgb" | "cmyk""rgb"Color matrix mode
grayscalebooleanfalseDesaturates the base image
trackWindowMousebooleanfalseTrack cursor outside the image bounds
disableOnMobilebooleanfalseDisable effects on viewports ≤ 768px
asElementType"img"Render as a custom component (e.g. Next.js Image)
onImageClickMouseEventHandlerNative 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

Keywords

react

FAQs

Package last updated on 26 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts