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

x/chalkpot_random_colors/random_palette.ts>randomPalette

Random colors are tools for generating attractive color, similar colors, color palettes or any random colors.
Latest
function randomPalette
import { randomPalette } from "https://deno.land/x/chalkpot_random_colors@1.0.0/random_palette.ts";

Example

const palette = randomPalette();
console.log(palette);
// [
//   [114.90..., 255, 255],
//   [126.65..., 255, 255],
//   [255, 122.43..., 240.57...],
//   [142.88..., 128.04..., 255],
//   [255, 127.67..., 177.44...]
// ]

const pastelPalette = randomPalette({
  palette: "pastel",
});

console.log(pastelPalette);
// [
//   [172.83..., 129.42..., 255],
//   [138.22..., 255, 255],
//   [255, 116.43..., 155.02...],
//   [114.46..., 119.88..., 255],
//   [133.54..., 255, 212.66...]
// ]

Parameters

optional
unnamed 0: { colorCount?: number; palette?: keyof palettes; } = [UNSUPPORTED]

Number of colors in the palette.