
Pixijs Color
Install this when you are wiring PixiJS v8 tints, fills, and strokes and need reliable hex, RGB, HSL, and alpha conversions without guessing accepted ColorSource formats.
Overview
PixiJS Color is an agent skill for the Build phase that teaches PixiJS v8 Color and ColorSource creation, conversion, and alpha manipulation for tints, fills, and strokes.
Install
npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-colorWhat is this skill?
- Documents every Color constructor input: hex integer, hex/CSS strings, RGB/HSL objects, arrays, and Uint8Array.
- Covers toHex, toNumber, toArray, and toRgba conversion plus component access and setAlpha.
- Explains multiply, premultiply, and the Color.shared singleton for reuse without allocating new Color instances.
- Shows practical fill, stroke, Graphics, and Sprite.tint patterns in v8 syntax.
- Cross-links pixijs-scene-graphics, pixijs-scene-sprite, and pixijs-blend-modes for compositing context.
Adoption & trust: 1.3k installs on skills.sh; 206 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You know the hex or CSS color you want in PixiJS v8 but the agent keeps mixing formats, alpha, premultiply, or Color.shared usage and breaks tints and fills.
Who is it for?
Solo builders implementing PixiJS v8 games or interactive graphics who need authoritative color conversion snippets in agent sessions.
Skip if: Teams not using PixiJS, or projects that only set one static hex string with no conversion or alpha math.
When should I use this skill?
Creating, converting, or manipulating colors in PixiJS v8; triggers on Color, ColorSource, hex, rgb, hsl, tint, premultiply, or Color.shared.
What do I get? / Deliverables
After the skill runs, your agent emits correct Color construction, conversion helpers, and tint/fill assignments that match PixiJS v8 APIs.
- Color conversion snippets
- Tint and fill assignments using Color or ColorSource
Recommended Skills
Journey fit
How it compares
Use instead of generic CSS color advice when the target runtime is PixiJS v8 ColorSource APIs, not DOM stylesheets.
Common Questions / FAQ
Who is pixijs-color for?
Indie and solo developers using PixiJS v8 for games or rich web graphics who want agents to handle Color and ColorSource correctly on the first pass.
When should I use pixijs-color?
Use it in Build → frontend while implementing Graphics fills, Sprite tints, stroke colors, or any workflow that converts between hex, RGB, HSL, arrays, and premultiplied alpha.
Is pixijs-color safe to install?
It is procedural documentation for the PixiJS Color API; review the Security Audits panel on this Prism page before trusting any third-party skill package in your repo.
SKILL.md
READMESKILL.md - Pixijs Color
The `Color` class creates and converts colors for tints, fills, strokes, and anywhere PixiJS accepts a `ColorSource`. Most APIs accept raw hex/strings directly, so explicit `new Color(...)` is only needed when converting formats or manipulating values. ## Quick Start ```ts const fillColor = new Color("#ff6600"); console.log(fillColor.toHex()); // '#ff6600' console.log(fillColor.toNumber()); // 0xff6600 console.log(fillColor.toArray()); // [1, 0.4, 0, 1] const g = new Graphics().rect(0, 0, 200, 100).fill(fillColor); app.stage.addChild(g); const sprite = Sprite.from("hero.png"); sprite.tint = "dodgerblue"; app.stage.addChild(sprite); const t = Color.shared.setValue(0xffffff).multiply([1, 0.5, 0.5]).toNumber(); sprite.tint = t; ``` **Related skills:** `pixijs-scene-graphics` (fill/stroke colors), `pixijs-scene-sprite` (tint), `pixijs-blend-modes` (compositing). ## Core Patterns ### Accepted input formats ```ts import { Color } from "pixi.js"; // Hex integer new Color(0xff0000); // Hex strings new Color("#ff0000"); new Color("#f00"); new Color("ff0000"); // CSS color names new Color("red"); new Color("dodgerblue"); // RGB/RGBA objects (components 0-255) new Color({ r: 255, g: 0, b: 0 }); new Color({ r: 255, g: 0, b: 0, a: 0.5 }); // HSL/HSLA objects new Color({ h: 0, s: 100, l: 50 }); new Color({ h: 0, s: 100, l: 50, a: 0.5 }); // HSV/HSVA objects new Color({ h: 0, s: 100, v: 100 }); // CSS strings new Color("rgb(255, 0, 0)"); new Color("rgba(255, 0, 0, 0.5)"); new Color("hsl(0, 100%, 50%)"); // Normalized 0-1 arrays (Float32Array or plain arrays) new Color([1, 0, 0]); // RGB new Color([1, 0, 0, 0.5]); // RGBA // Uint8 arrays (components 0-255) new Color(new Uint8Array([255, 0, 0])); new Color(new Uint8ClampedArray([255, 0, 0, 128])); // 8-digit hex with alpha new Color("#ff0000ff"); new Color("#f00f"); // Copy from another Color instance const red = new Color("red"); const copy = new Color(red); ``` ### Conversion methods ```ts import { Color } from "pixi.js"; const color = new Color("#ff6600"); color.toHex(); // '#ff6600' color.toHexa(); // '#ff6600ff' (hex with alpha) color.toNumber(); // 0xff6600 color.toArray(); // [1, 0.4, 0, 1] (normalized RGBA) color.toRgbArray(); // [1, 0.4, 0] (normalized RGB, no alpha) color.toRgbaString(); // 'rgba(255,102,0,1)' color.toRgba(); // { r: 1, g: 0.4, b: 0, a: 1 } color.toRgb(); // { r: 1, g: 0.4, b: 0 } color.toUint8RgbArray(); // [255, 102, 0] // setValue() is the chainable way to change a color's value color.setValue(0xff0000).toHex(); // '#ff0000' ``` ### Component access ```ts import { Color } from "pixi.js"; const color = new Color("rgba(255, 128, 0, 0.8)"); color.red; // 1 color.green; // ~0.502 color.blue; // 0 color.alpha; // 0.8 ``` All component getters return normalized 0-1 values. ### Manipulation ```ts import { Color } from "pixi.js"; const color = new Color("red"); // Set alpha (chainable) color.setAlpha(0.5); // Multiply with another color (destructive, modifies in place) color.multiply(0x808080); // Premultiply alpha (destructive, RGB channels multiplied by alpha) color.premultiply(0.8); // Premultiply alpha only (RGB unchanged) color.premultiply(0.8, false); // Chain operations new Color("white").setAlpha(0.5).multiply([0.8, 0.2, 0.2]); ``` `multiply()` and `premultiply()` are destructive; they modify the color and set `value` to null (original format is lost). ### Non-destructive premultiplied output ```ts import { Color } from "pixi.js"; const color = new Color("red").setAlpha(0.5); cons