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

jb-color-picker

v0.2.0

Published

RGB and OKLCH color picker web component

Readme

jb-color-picker

A standalone web component for selecting colors in RGB and OKLCH. It deliberately does not behave as a form input; it is designed to be composed into a future color-input component.

import "jb-color-picker";

const picker = document.querySelector("jb-color-picker");
picker.value = { colorSpace: "oklch", l: 0.7, c: 0.15, h: 250, alpha: 1 };
picker.value = "oklch(70% 0.15 250 / 1)";
picker.addEventListener("change", event => console.log(event.detail.value, event.detail.valueObject));
<jb-color-picker color-space="rgb"></jb-color-picker>

Value API

The value getter returns a normalized CSS color string. Its setter accepts either a supported CSS color string or one of these typed objects:

type RGBColor = { colorSpace: "rgb"; r: number; g: number; b: number; alpha: number };
type OKLCHColor = { colorSpace: "oklch"; l: number; c: number; h: number; alpha: number };

Supported string syntaxes are modern or comma-separated rgb()/rgba(), oklch(), and 3/4/6/8-digit hexadecimal colors. Invalid or unsupported strings are ignored. Use the readonly valueObject getter to retrieve the normalized typed object.

RGB channels use 0..255. OKLCH uses 0..1 lightness, 0..0.4 chroma, and 0..360 hue. Alpha uses 0..1.

colorSpace defaults to null, which displays the RGB/OKLCH switch. Setting it to "rgb" or "oklch" locks the picker to that space, converts the current color, and hides the switch. Set it back to null to let the user switch again.

The component dispatches composed, bubbling input and change custom events. Both expose the CSS string at event.detail.value and typed data at event.detail.valueObject. valueAsString remains an alias of value.

Set alphaEnabled = false or add alpha-disabled to hide alpha controls. Set disabled to disable interaction.

React

import { JBColorPicker } from "jb-color-picker/react";

<JBColorPicker value="rgb(255 80 40 / 1)" colorSpace="rgb" onChange={event => console.log(event.detail.valueObject)} />