Skip to main content
Module

x/colors/mod.ts>findClosestColor

Color conversion and stuff in TypeScript
Go to Latest
function findClosestColor
import { findClosestColor } from "https://deno.land/x/colors@v2.0.0-rc.1/mod.ts";

Find the nearest neighbour of a color in a palette It would be more accurate to use consider luminance along with Euclidean distance but I chose to stay with distance for performance.

Parameters

color: number[]
palette: number[][]

Returns

number[]