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

@volgakurvar/pixi-filter-multi-color-replace

v1.0.0

Published

High-performance multi-color replace filter for PixiJS with optimized fragment shader

Downloads

8

Readme

@volgakurvar/pixi-filter-multi-color-replace

A high-performance multi-color replacement filter for PixiJS. Achieves fast processing through texture-based color replacement using color map textures. This filter is blazing faster than original pixi-filters/multi-color-replace filter when replacement count is big.

Features

  • ✅ High-speed color replacement with color map textures
  • ✅ PixiJS v8 support
  • ✅ Full TypeScript support
  • ✅ WebGL & WebGPU compatible
  • ✅ Supports ~16 million color replacements with 4096x4096 color map

Installation

npm install @volgakurvar/pixi-filter-multi-color-replace

Usage

Basic Usage

import { Application, Sprite, Color } from "pixi.js";
import { MultiColorReplaceFilter } from "@volgakurvar/pixi-filter-multi-color-replace";

const app = new Application();
const sprite = Sprite.from("your-image.png");

// Replace red with blue
const filter = new MultiColorReplaceFilter({
  replacements: [
    [new Color(0xff0000), new Color(0x0000ff)], // [source color, target color]
  ],
});

sprite.filters = [filter];
app.stage.addChild(sprite);

Multiple Color Replacement

const filter = new MultiColorReplaceFilter({
  replacements: [
    [new Color(0xff0000), new Color(0x0000ff)], // red → blue
    [new Color(0x00ff00), new Color(0xffff00)], // green → yellow
    [new Color(0x0000ff), new Color(0xff0000)], // blue → red
  ],
});

API

MultiColorReplaceFilter

Constructor

new MultiColorReplaceFilter(options: MultiColorReplaceFilterOptions)

Options

| Property | Type | Description | | -------------- | ----------------------- | ------------------------------- | | replacements | Array<[Color, Color]> | Array of color pairs (required) |

Properties

| Property | Type | Description | | -------------- | ----------------------------------- | ------------------------------------ | | replacements | Array<[ColorSource, ColorSource]> | Color replacement pairs (read/write) |

Methods

| Method | Description | | ----------- | --------------------------------------------------------------------- | | refresh() | Call after directly modifying the replacements array to update filter |

Color Type

Colors use PixiJS's Color class:

import { Color } from "pixi.js";

// Create from hex
const red = new Color(0xff0000);

// Create from RGB values (0-255)
const blue = new Color([0, 0, 255]);

// Create from RGB values (0-1)
const green = new Color([0, 1, 0]);

Technical Specifications

Color Map Texture

This filter uses a 4096x4096 color map texture for color replacement:

  • Size: 4096x4096 pixels
  • Encoding: RGB values mapped to coordinates (R + G256 + B256*256)
  • Grid Structure: Organized as 16x16 blue channel grids

Performance

  • Memory Usage: ~67MB color map texture
  • Processing Speed: O(1) color replacement through texture lookup
  • GPU Optimization: High-speed rendering with WebGL/WebGPU support

Browser Support

  • Chrome 91+
  • Firefox 89+
  • Safari 14.1+
  • Edge 91+

Browsers that support WebGL 2.0 or WebGPU are required.

Demo

Open example.html in your browser to see the demo.

Development

# Install dependencies
npm install

# Build
npm run build

# Development mode (watch)
npm run dev

License

MIT License

Related Packages

Contributing

Please report bugs and feature requests at Issues.

Acknowledgements

Great thanks to the January Desk for the inspiration https://youtu.be/tAU95loPiD8?si=Kmt9kXNlGiwVI5qm