rybitten
Version:
A color space conversion library for transforming between RGB and RYB colors.
61 lines (60 loc) • 2.06 kB
TypeScript
/**
* 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[] & { length: 8 }} ColorCube
*/
export type ColorCube = ColorCoords[] & {
length: 8;
};
/**
* 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 = Map<string, {
title: string;
author: string;
reference: string;
year: number;
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;
/**
* Collection of historical and contemporary RYB color cube definitions.
* Each cube is based on different color theories and historical works.
* Includes cubes from:
* - Historical color theorists (Itten, Goethe, Munsell, etc.)
* - Contemporary sources (Apple manuals, Marvel comics)
* - Modern digital artists (Ippsketch, etc.)
*
* Each entry contains:
* - title: Name of the color system/work
* - author: Creator of the color system
* - year: Year of creation
* - reference: Reference image filename
* - cube: The actual color values as RGB coordinates
*/
declare const cubes: CubesMap;
export { cubes };