npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@martinlaxenaire/color-palette-generator

v2.0.1

Published

A small, lightweight utility helper to generate color palettes based on a given input color.

Readme

Color palette generator

A small, lightweight utility helper to generate color palettes based on a given input color.

Uses the theory explained in this video, which is to generate a base palette as a set of colors around the given base color by shifting its hue increasingly, then creates additional lighter and darker palettes by manipulating the base palette colors saturation and brightness.

Demo

Installation

npm

npm i @martinlaxenaire/color-palette-generator

yarn

yarn add @martinlaxenaire/color-palette-generator

Or use any other package manager.

Example

Creating colors

import { ColorModel } from '@martinlaxenaire/color-palette-generator'

const redColor = new ColorModel('#ff0000')
const randomColor = new ColorModel()
const greenColor = new ColorModel('#29ab63')

const brighterGreenColor = greenColor.clone().saturateHsv(10).brighten(10)

Creating palette generators

import { ColorModel, ColorPaletteGenerator } from '@martinlaxenaire/color-palette-generator'

// create a palette generator from a random color
const palette = new ColorPaletteGenerator()

const greenColor = new ColorModel('#29ab63')

// create another palette generator from a green color
const paletteFromColor = new ColorPaletteGenerator({
  precision: 6,
  baseColor: greenColor, // we could also pass 'greenColor.hex' hexadecimal representation
})

Getting random palettes

A random palette just picks colors randomly from the color palette generator.

import { ColorModel, ColorPaletteGenerator } from '@martinlaxenaire/color-palette-generator'

const greenColor = new ColorModel('#29ab63')

// create a palette from a green color
const paletteFromColor = new ColorPaletteGenerator({
  precision: 6,
  baseColor: greenColor, // we could also pass 'greenColor.hex' hexadecimal representation
})

// get a random palette of 4 colors based on 'paletteFromColor'
const randomPaletteFromColor = paletteFromColor.getRandomPalette()

Getting distributed palettes

A distributed palette picks colors based on their brightness/value. It picks half its colors on a medium brightness range (between 37.5 and 87.5), a quarter with low brightness (under 37.5) and the last quarter with high brightness (over 87.5).

import { ColorPaletteGenerator } from '@martinlaxenaire/color-palette-generator'

// create a palette from a random color
const palette = new ColorPaletteGenerator()

// get a distributed palette of 6 colors based on 'palette'
const distributedPalette = palette.getDistributedPalette({
  length: 6,
})

// get a distributed palette based on 'palette', excluding colors too dark or too light
const anotherDistributedPalette = palette.getDistributedPalette({
  minBrightness: 10,
  maxBrightness: 90,
})