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

@licheff/dark-mode-switch

v0.1.1

Published

Animated dark mode toggle components for React — ripple, bulb, and CRT variants

Downloads

198

Readme

dark-mode-switch

Animated dark/light mode toggle components for React. Three variants — each with its own distinct animation effect.

▶ Live demo · npm

Variants

| Component | Animation | |---|---| | ThemeToggleRipple | Full-screen ripple that expands from the button's position using the View Transitions API | | ThemeToggleBulb | A circle expands out (switching to light) or contracts in (switching to dark) from the button | | ThemeToggleCRT | The page collapses to a horizontal line like an old CRT monitor turning off, then snaps back |

Requirements

Installation

npm install @licheff/dark-mode-switch

Setup

1. Wrap your app with ThemeProvider

In your main.tsx (or equivalent entry point):

import { ThemeProvider } from 'next-themes'
import '@licheff/dark-mode-switch/style.css'

<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
  <App />
</ThemeProvider>

The attribute="class" setting tells next-themes to apply a dark class to <html>, which Tailwind's dark: variants depend on.

2. Add the dark variant to your CSS

In your global stylesheet:

@custom-variant dark (&:is(.dark *));

3. Scan the package with Tailwind

So Tailwind picks up the utility classes used inside the components:

@source "../../node_modules/@licheff/dark-mode-switch/dist";

Usage

import { ThemeToggleRipple } from '@licheff/dark-mode-switch'
// or: ThemeToggleBulb, ThemeToggleCRT

export function MyNav() {
  return <ThemeToggleRipple />
}

Props

All three components share the same props:

| Prop | Type | Default | Description | |---|---|---|---| | size | 'sm' \| 'md' \| 'lg' | 'md' | Controls icon and button size | | className | string | '' | Applied to the button element |

Size reference:

| Size | Icon | Button | |---|---|---| | sm | 16px | 32×32px | | md | 20px | 44×44px (WCAG minimum) | | lg | 24px | 48×48px |

Browser support

The ripple animation uses the View Transitions API (Chrome 111+, Edge 111+, Safari 18+, Firefox 130+). All variants fall back gracefully — the theme still switches, just without the animation.

prefers-reduced-motion is respected: animations are suppressed, but theme switching still works.