Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/colors/src/common.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/src/common.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[]