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

twitch-core-ui-utils

v21.0.1-ep.0

Published

Common utilities for Twitch Core UI

Readme

Accent Color Generator

Algorithm Overview

Accepts one input color, expressed as an RGB value (three integers, each between 0 and 255). Output five generated colors ranging from light to dark that are representative of the input color.

Contrast Requirements

  1. Minimum 4.5 contrast ratio between colors 1 and 4
  2. Minimum 4.5 contrast ratio between colors 2 and 5
  3. Minimum contrast ratio between color 5 and rgb(230, 230, 234)
  4. Minimum contrast ratio between color 1 and rgb(38, 38, 44)
  5. Contrast distance between the scale of colors is symmetrical

Value storage

The original input color must be stored along with the five generated colors. The generated colors may be stored or cached. The algorithm will not be changed frequently, but assume that at some point in the future we might want to tweak it and re-generate all values based on the original input colors.

The API must provide all six colors (original color plus five generated colors). The original input color is not always included in the set of five generated colors even though the first color may often be identical to it.

Algorithm Implementation

Core UI team has a Javascript implementation which meets all requirements. It has been written with zero dependancies and can be re-implemented in another language, if needed, for server-side calculations. The algorithm is divided into two supporting parts:

  1. A function to calculate contrast ratio changes needed from the input color and to generate five colors, each based on the previous.

The input color will be used for the first color, unless it is too dark in which case it will be lightened exactly as much is necessary to meet contrast requirements for all colors in the set.

  1. A function, changeColor, will lighten or darken a given color until a specified contrast ratio has been met. The contrast ratio of the returned color may be higher than the specified contrast ratio. If a color cannot be darkened or lightened to achieve the specified contrast ratio, then either black or white will be returned.