Module Spectrum_palette_ppx

PPX extension for generating color palettes from JSON.

This library provides:

The PPX extension reads JSON palette definitions and generates OCaml modules implementing the Palette.M signature with efficient nearest-color lookup using octree-based spatial indexing in LAB color space.

Example Usage

  (* Define a palette from JSON *)
  module MyPalette : Palette.M = [%palette "colors.json"]

  (* Use the generated palette *)
  let red = MyPalette.of_string "red"
  let code = MyPalette.to_code red
  let nearest = MyPalette.nearest (Gg.Color.v 0.5 0.3 0.7 1.0)
module Palette : sig ... end

Palette module type and runtime utilities.

module Private : sig ... end

Internal modules exposed for testing purposes.