UNPKG

sharp-vibrant

Version:

Extract prominent colors from an image in a node environment using sharp.

17 lines (13 loc) 465 B
import type { Filter } from '../typing'; export { default as Default } from './default'; export function combineFilters(filters: Filter[]): Filter | null { // TODO: caching if (!Array.isArray(filters) || filters.length === 0) return null; return (r: number, g: number, b: number, a: number) => { if (a === 0) return false; for (let i = 0; i < filters.length; i += 1) { if (!filters[i](r, g, b, a)) return false; } return true; }; }