UNPKG

rybitten

Version:

A color space conversion library for transforming between RGB and RYB colors.

50 lines (49 loc) 1.6 kB
import { ColorCube } from './cubes'; export * from './main'; export declare const RYB = "ryb"; export declare const RYBHSL = "rybhsl"; export declare const ryb: (cube?: ColorCube) => { mode: string; cube: ColorCube | undefined; }; export declare const rybhsl: (cube?: ColorCube) => { mode: string; cube: ColorCube | undefined; }; /** * Minimal shape of the p5 constructor we depend on. @types/p5 describes the * runtime instance, not the prototype-patching surface we use here, so this * narrow interface is clearer than trying to reuse the upstream types. */ interface P5Constructor { prototype: P5Prototype; } interface P5Prototype { colorMode: (...args: unknown[]) => unknown; fill: (...args: unknown[]) => unknown; stroke: (...args: unknown[]) => unknown; background: (...args: unknown[]) => unknown; color: (...args: unknown[]) => unknown; registerMethod: (hook: string, fn: (this: P5Instance) => void) => void; _rybExtended?: boolean; RYB?: string; RYBHSL?: string; ryb?: typeof ryb; rybhsl?: typeof rybhsl; } /** * Bookkeeping fields we attach to individual p5 instances. These are internal * to this extension — never part of the public p5 API. */ interface P5Instance { constructor: P5Constructor; _rybMode?: string | false | any; _rybMaxes?: [number, number, number, number]; _rybCube?: ColorCube; } /** * Extends p5.js with RYB color mode support. * Called automatically on library load. Can be invoked manually: * rybitten.extendP5(p5) */ export declare function extendP5(p5: P5Constructor): void;