Palettes that can be plugged into the tiny pockets press https://git.lewismoten.com/tiny-pockets-press/dither-lib/raw/branch/main/index.html
  • JavaScript 100%
Find a file
2026-06-21 00:36:15 -04:00
amber2 copy files from tiny-pocket-press 2026-06-20 20:13:06 -04:00
ansi16 pretty 2026-06-20 20:40:55 -04:00
atari400 pretty 2026-06-20 20:40:55 -04:00
atari400base pretty 2026-06-20 20:40:55 -04:00
c64 pretty 2026-06-20 20:40:55 -04:00
cga0 pretty 2026-06-20 20:40:55 -04:00
cga1 pretty 2026-06-20 20:40:55 -04:00
cmyk-overprint add CMYK overprint 2026-06-21 00:36:15 -04:00
colors4 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
colors8 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
colors16 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
colors27 add more palettes 2026-06-20 20:32:46 -04:00
colors32 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
colors64 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
colors125 add more palettes 2026-06-20 20:32:46 -04:00
colors128 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
colors256 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
ega16 pretty 2026-06-20 20:40:55 -04:00
eink2 Add palettes to mimic e-Ink 2026-06-20 20:37:02 -04:00
eink3red Add palettes to mimic e-Ink 2026-06-20 20:37:02 -04:00
eink3yellow Add palettes to mimic e-Ink 2026-06-20 20:37:02 -04:00
eink4 Add palettes to mimic e-Ink 2026-06-20 20:37:02 -04:00
gray2 add more palettes 2026-06-20 20:32:46 -04:00
gray4 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
gray8 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
gray16 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
gray32 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
gray64 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
gray128 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
gray256 reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
green2 copy files from tiny-pocket-press 2026-06-20 20:13:06 -04:00
lcd4 add 4-color lcd 2026-06-20 20:34:13 -04:00
websafe reduce size of some palettes using logic 2026-06-20 20:28:50 -04:00
windows16 pretty 2026-06-20 20:40:55 -04:00
xterm256 pretty 2026-06-20 20:40:55 -04:00
.gitignore Initial commit 2026-06-21 00:05:19 +00:00
library.js add CMYK overprint 2026-06-21 00:36:15 -04:00
LICENSE.md setup prettier 2026-06-20 20:40:48 -04:00
package-lock.json setup prettier 2026-06-20 20:40:48 -04:00
package.json setup prettier 2026-06-20 20:40:48 -04:00
README.md add CMYK overprint 2026-06-21 00:36:15 -04:00

Palette Plugins

This repository contains JavaScript palette plugins and a palette library registry.

Each palette is a standalone .js file that registers itself at runtime.

The library registry is defined in library.js, which calls TPP.registerPaletteLibrary(...) with the list of available palettes and their retrieval URLs.

Library registration looks like this:

(function () {
  const registerPaletteLibrary =
    window.TPP && window.TPP.registerPaletteLibrary;
  if (typeof registerPaletteLibrary !== "function") return;

  registerPaletteLibrary({
    palettes: [
      {
        id: "sample4",
        name: "Sample 4-Color",
        url: "https://git.lewismoten.com/tiny-pockets-press/palette-lib/sample4.js",
        colorCount: 4,
        description:
          "A simple 4-color sample palette for demonstrating the plugin format.",
      },
    ],
  });
})();

Palette plugins should call TPP.registerPalette(...):

(function () {
  const name = "Sample 4-Color";
  const baseMessage = `Palette "${name}" could not register.`;
  const logError = function (message, err) {
    if (typeof console !== "undefined" && typeof console.error === "function") {
      if (arguments.length > 1) console.error(message, err);
      else console.error(message);
    }
  };
  const registerPalette = window.TPP && window.TPP.registerPalette;
  if (typeof registerPalette !== "function") {
    logError(`${baseMessage} TPP.registerPalette not found.`);
    return;
  }
  try {
    registerPalette({
      schemaVersion: 1,
      id: "sample4",
      name: name,
      description:
        "A simple 4-color sample palette for demonstrating the plugin format.",
      colorNumbers: [0, 1, 2, 3],
      colorNames: ["black", "red", "green", "yellow"],
      colors: ["#000000", "#ff0000", "#00ff00", "#ffff00"],
    });
  } catch (err) {
    logError(baseMessage, err);
  }
})();

Runtime API:

  • TPP.registerPalette(plugin) registers a palette plugin.
  • TPP.registerPaletteLibrary({ palettes }) registers the available palette library for lazy loading.

Included palettes include hardware-inspired sets, grayscale ramps, e-paper variants, and print-style options such as cmyk-overprint, which matches the CMYK overprint palette used by the dither demo.