UNPKG

rybitten

Version:

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

52 lines (51 loc) 1.71 kB
/** * Represents a color in RGB/HSX... space as an array of three numbers. * @typedef {[number, number, number]} ColorCoords */ export type ColorCoords = [number, number, number]; /** * Represents a color cube with exactly 8 RGB colors for RYB to RGB mapping. * The colors are ordered as: white, red, yellow, orange, blue, violet, green, black * @typedef {[ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords]} ColorCube */ export type ColorCube = [ ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords, ColorCoords ]; /** * Map storing historical and modern color cube definitions with their metadata. * @typedef {Map<string, { * title: string, * author: string, * reference: string, * year: number, * cube: ColorCube * }>} CubesMap */ export type CubesMap = ReadonlyMap<string, { readonly title: string; readonly author: string; readonly reference: string; readonly year: number; readonly cube: ColorCube; }>; /** * Default RYB color cube based on Johannes Itten's chromatic circle (1961). * Contains 8 key colors in RGB space: * 1. White - Base color, slightly warm [253/255, 246/255, 237/255] * 2. Red - Primary [227/255, 36/255, 33/255] * 3. Yellow - Primary [243/255, 230/255, 0] * 4. Orange - Secondary [240/255, 142/255, 28/255] * 5. Blue - Primary [22/255, 153/255, 218/255] * 6. Violet - Secondary [120/255, 34/255, 170/255] * 7. Green - Secondary [0, 142/255, 91/255] * 8. Black - Shade [29/255, 28/255, 28/255] */ export declare const RYB_ITTEN: ColorCube; export declare const cubes: CubesMap;