Skip to main content
skill CX Codex

pixijs-blend-modes — Claude Code skill: PixiJS v8 blend modes

A skill that tells your agent how to composite PixiJS v8 display objects with blendMode: standard modes, advanced ones, and batch-friendly ordering.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add pixijs/pixijs-skills --skill pixijs-blend-modes -a claude-code
Open on GitHub

What pixijs-blend-modes does

The skill kicks in whenever blendMode shows up in PixiJS v8 code. Your agent gets working patterns: standard modes (normal, add, multiply, screen, erase, min, max) run on GPU blend equations and stay cheap, while advanced ones like color-burn or overlay need the pixi.js/advanced-blend-modes import and go through the filter pipeline.

The silent fallback is the part worth knowing. Skip the extension import, or forget useBackBuffer: true when initialising on WebGL, and the mode quietly becomes normal with a warning in the console. In v8 BLEND_MODES is a TypeScript type only, so the old BLEND_MODES.ADD from v7 throws at runtime.

Ordering gets its own section. A blend-mode change breaks the render batch: two screen sprites in a row cost 2 draw calls, alternating screen / normal / screen / normal costs 4. Advanced modes rely on Filter.defaultOptions, whose resolution defaults to 1, so on a high-DPI target the blended object can look clipped or only partly applied. That is your cue to check the filter resolution.

What it helps with

  • build a glow effect from sprites with additive blending
  • darken a scene with a multiply layer instead of editing pixels
  • enable overlay and color-burn, which are not in the standard set
  • reorder container children to cut draw calls
  • migrate code from the v7 BLEND_MODES enum to v8 strings

Example prompts for the agent

  • Set the glow sprite's blendMode to add and put it on the stage
  • Import pixi.js/advanced-blend-modes and set the overlay sprite to color-burn
  • Reorder the container children so sprites sharing a blendMode sit next to each other

How to install pixijs-blend-modes

1Skills CLI (Vercel)

npx skills add pixijs/pixijs-skills --skill pixijs-blend-modes -a claude-code

2Manually: put the files in place

~/.claude/skills/pixijs-blend-modes/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pixijs-blend-modes/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pixijs-blend-modes

How do I install pixijs-blend-modes in Claude?

Run npx skills add pixijs/pixijs-skills --skill pixijs-blend-modes -a claude-code. The skill lands in ~/.claude/skills/pixijs-blend-modes/SKILL.md.

What does the pixijs-blend-modes skill do?

It hands your agent patterns for PixiJS v8 compositing: standard blend modes, advanced modes via pixi.js/advanced-blend-modes, and child ordering that keeps batching intact.

Why does color-burn silently fall back to normal?

Most likely the pixi.js/advanced-blend-modes import is missing, or useBackBuffer: true was not set when initialising on WebGL. Without either, PixiJS logs a warning and falls back to plain blending.

Source text

SKILL.md · MIT
---
name: pixijs-blend-modes
description: "Use this skill when compositing display objects with blend modes in PixiJS v8. Covers standard modes (normal, add, multiply, screen, erase, min, max), advanced modes via pixi.js/advanced-blend-modes (color-burn, overlay, hard-light, etc.), batch-friendly ordering. Triggers on: blendMode, additive, multiply, screen, overlay, color-burn, color-dodge, advanced-blend-modes, glow, erase."
license: MIT
---

Set `container.blendMode` to composite display objects with GPU blend equations (standard modes) or filter-based advanced modes. Blend-mode transitions break render batches, so group like-mode siblings together.

## Quick Start

```ts
const light = new Sprite(await Assets.load("light.png"));
light.blendMode = "add";
app.stage.addChild(light);

const shadow = new Sprite(await Assets.load("shadow.png"));
shadow.blendMode = "multiply";
app.stage.addChild(shadow);

import "pixi.js/advanced-blend-modes";
const overlay = new Sprite(await Assets.load("overlay.png"));
overlay.blendMode = "color-burn";
app.stage.addChild(overlay);
```

**Related skills:** `pixijs-filters` (advanced modes use the filter pipeline), `pixijs-performance` (batching with blend modes), `pixijs-color` (color manipulation).

## Core Patterns

### Standard blend modes

Standard modes are built in and use GPU blend equations directly:

```ts
import { Sprite } from "pixi.js";

sprite.blendMode = "normal"; // standard alpha compositing (effective default at root)
sprite.blendMode = "add"; // additive (lighten, glow effects)
sprite.blendMode = "multiply"; // multiply (darken, shadow effects)
sprite.blendMode = "screen"; // screen (lighten, dodge effects)
sprite.blendMode = "erase"; // erase pixels from render target
sprite.blendMode = "none"; // no blending, overwrites destination
sprite.blendMode = "inherit"; // inherit from parent (this is the actual default value)
sprite.blendMode = "min"; // keeps minimum of source and destination (WebGL2+ only)
sprite.blendMode = "max"; // keeps maximum of source and destination (WebGL2+ only)
```

These are hardware-accelerated and cheap. They do not require filters.

### Advanced blend modes

Advanced modes require an explicit import to register the extensions. On the WebGL renderer they also require `useBackBuffer: true` at init time, or PixiJS logs a warning and the blend silently falls back:

```ts
import "pixi.js/advanced-blend-modes";
import { Application, Sprite, Assets } from "pixi.js";

const app = new Application();
await app.init({ useBackBuffer: true }); // required for advanced modes on WebGL

const texture = await Assets.load("overlay.png");
const overlay = new Sprite(texture);
overlay.blendMode = "color-burn";
```

Available advanced modes:

| Mode           | Effect                                          |
| -------------- | ----------------------------------------------- |
| `color-burn`   | Darkens by increasing contrast                  |
| `color-dodge`  | Brightens by decreasing contrast                |
| `darken`       | Keeps darker of two layers                      |
| `difference`   | Absolute difference                             |
| `divide`       | Divides bottom by top                           |
| `exclusion`    | Similar to difference, lower contrast           |
| `hard-light`   | Multiply or screen based on top layer           |
| `hard-mix`     | High contrast threshold blend                   |
| `lighten`      | Keeps lighter of two layers                     |
| `linear-burn`  | Adds and subtracts to darken                    |
| `linear-dodge` | Adds layers together                            |
| `linear-light` | Linear burn or dodge based on top layer         |
| `luminosity`   | Luminosity of top, hue/saturation of bottom     |
| `negation`     | Inverted difference                             |
| `overlay`      | Multiply or screen based on bottom layer        |
| `pin-light`    | Replaces based on lightness comparison          |
| `saturation`   | Saturation of top, hue/luminosity of bottom     |
| `soft-light`   | Gentle overlay effect                           |
| `subtract`     | Subtracts top from bottom                       |
| `vivid-light`  | Color burn or dodge based on top layer          |
| `color`        | Hue and saturation of top, luminosity of bottom |

You set advanced blend modes the same way as standard ones, via the `blendMode` property. They use filters internally, so they cost more than standard modes.

### Batch-friendly ordering

Different blend modes break the rendering batch. Order objects to minimize transitions:

```ts
import { Container, Sprite } from "pixi.js";

const scene = new Container();
scene.addChild(screenSprite1); // 'screen'
scene.addChild(screenSprite2); // 'screen'
scene.addChild(normalSprite1); // 'normal'
scene.addChild(normalSprite2); // 'normal'
```

2 draw calls. Alternating order (`screen, normal, screen, normal`) would produce 4.

## Common Mistakes

### [HIGH] Not importing advanced-blend-modes extension

Wrong:

```ts
import { Sprite } from "pixi.js";

sprite.blendMode = "color-burn"; // silently falls back to normal
```

Correct:

```ts
import "pixi.js/advanced-blend-modes";
import { Sprite } from "pixi.js";

sprite.blendMode = "color-burn";
```

Advanced blend modes (color-burn, overlay, etc.) require the extension import. Without it, only standard modes (normal, add, multiply, screen) are available. The invalid mode silently falls back.


### [MEDIUM] Mixing blend modes across adjacent objects

Different blend modes break the render batch. `screen / normal / screen / normal` produces 4 draw calls, while `screen / screen / normal / normal` produces 2. Sort children so objects with the same blend mode are adjacent.


### [HIGH] Using the v7 BLEND_MODES enum

Wrong:

```ts
import { BLEND_MODES } from "pixi.js";

sprite.blendMode = BLEND_MODES.ADD; // runtime error: BLEND_MODES is undefined
```

Correct:

```ts
sprite.blendMode = "add";
```

In v8, `BLEND_MODES` is a TypeScript type only (a union of string literals). There is no runtime enum export, so `BLEND_MODES.ADD` evaluates to accessing a property on `undefined`. Use the string form.


### [HIGH] Advanced blend modes without useBackBuffer

Wrong:

```ts
import "pixi.js/advanced-blend-modes";
await app.init({
  /* no useBackBuffer */
});
sprite.blendMode = "color-burn"; // logs a warning, falls back
```

Correct:

```ts
import "pixi.js/advanced-blend-modes";
await app.init({ useBackBuffer: true });
sprite.blendMode = "color-burn";
```

Advanced modes read from the back buffer. On WebGL, the blend silently falls back if the back buffer is not enabled. WebGPU enables the back buffer unconditionally.


### [MEDIUM] Advanced blend modes clipped or scaled on high-DPI renderers

Advanced blend modes are filter-based and use `Filter.defaultOptions`, whose resolution defaults to `1`. On a high-DPI render target the blended object can look clipped, scaled, or only partially applied.

Wrong:

```ts
import "pixi.js/advanced-blend-modes";

sprite.blendMode = "overlay"; // renders at resolution 1, can clip on retina
```

Correct:

```ts
import { Filter } from "pixi.js";
import "pixi.js/advanced-blend-modes";

Filter.defaultOptions.resolution = "inherit"; // set before creating affected objects

sprite.blendMode = "overlay";
```

Setting `Filter.defaultOptions.resolution = "inherit"` makes advanced blend modes render at the render target's resolution. This costs more memory and runtime, so apply it where fidelity matters.


## API Reference

- [Container.blendMode](https://pixijs.download/release/docs/scene.Container.html.md)
- [OverlayBlend](https://pixijs.download/release/docs/filters.OverlayBlend.html.md)
- [ColorBurnBlend](https://pixijs.download/release/docs/filters.ColorBurnBlend.html.md)
- [ColorDodgeBlend](https://pixijs.download/release/docs/filters.ColorDodgeBlend.html.md)
- [HardLightBlend](https://pixijs.download/release/docs/filters.HardLightBlend.html.md)
- [SoftLightBlend](https://pixijs.download/release/docs/filters.SoftLightBlend.html.md)
- [DifferenceBlend](https://pixijs.download/release/docs/filters.DifferenceBlend.html.md)

© pixijs · MIT · pixijs/pixijs-skills

Similar skills

Everything for Frontend and UI →

From the same set25

pixijs-scene-core-concepts Explains how the PixiJS v8 scene graph fits together: containers, leaves, transforms and render order. Useful when your agent writes PixiJS code. CX Codex +1 5,900installs pixijs-math A skill covering coordinates, matrices, shapes and hit testing in PixiJS v8. Useful when a point has to move between coordinate spaces or a container needs a custom hit area. CX Codex +1 5,900installs pixijs-scene-mesh Guides custom 2D geometry rendering in PixiJS v8 via Mesh, MeshPlane, MeshRope, and PerspectiveMesh. Useful for per-frame vertex animations, rope trails, and perspective distortion. CX Codex +1 5,700installs pixijs-scene-dom-container Teaches the agent how to overlay HTML elements on a PixiJS v8 canvas with DOMContainer and DOMPipe. Useful for native inputs, iframes or video that must follow a display object. CX Codex +1 5,700installs pixijs-color PixiJS v8 skill for the Color class. It guides color conversions, tint calculations, and buffer reuse to prevent GC spikes in animation loops. CX Codex +1 5,700installs pixijs-create The skill walks your agent through scaffolding a PixiJS v8 project or adding the library to an existing one: templates, package managers, TypeScript setup. CX Codex +1 5,700installs pixijs-custom-rendering Guides your agent through custom shaders, uniforms, filters and batchers in PixiJS v8, in GLSL and WGSL, for WebGL and WebGPU. CX Codex +1 5,700installs pixijs-scene-gif Teaches coding assistants how to load and play animated GIFs in PixiJS v8 with GifSprite. Useful when embedding GIF assets directly into scene trees. CX Codex +1 5,600installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor