interface PlteChunk
extends Omit<PngChunkUnknown, "type" | "data">

Refined PLTE (Palette) chunk structure.

The PLTE chunk contains the color palette for indexed-color PNG images (color type 3). Each palette entry is an RGB triplet.

Examples

Example 1

import { assertEquals } from "@std/assert";
import type { PlteChunk } from "@binstruct/png";

const plte: PlteChunk = {
  length: 9,
  type: "PLTE",
  data: {
    colors: [
      [255, 0, 0],   // Red
      [0, 255, 0],   // Green
      [0, 0, 255],   // Blue
    ],
  },
  crc: 0x12345678,
};

assertEquals(plte.data.colors.length, 3);
assertEquals(plte.data.colors[0], [255, 0, 0]);

Properties

type: "PLTE"

Chunk type identifier, always "PLTE"

data: { colors: [number, number, number][]; }

Parsed palette data

Usage

import { type PlteChunk } from ".";