UNPKG

extract-colors

Version:

Extract color palettes from images

32 lines (31 loc) 984 B
import Color from "./Color"; import LeafGroup from "./LeafGroup"; /** * RootGroup colors with algorithms to optimize and merge neighbors colors. * * @class * @classdesc Manage list of colors or groups. */ export default class RootGroup { _count: number; _children: Record<number, LeafGroup>; /** * Store colors or groups and _count similiar groups in the image. */ constructor(); /** * Get list of groups of list of colors. */ getList(): LeafGroup[]; addColor(r: number, g: number, b: number): Color; /** * Add a key for a color, this key is a simplification to find neighboring colors. * Neighboring colors has same key. */ getLeafGroup(key: number): LeafGroup; /** * List of colors sorted by importance (neighboring hare calculated by distance and removed). * Importance is calculated with the saturation and _count of neighboring colors. */ getColors(_distance: number): Color[]; }