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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rnzeus/harmonia

v0.1.3

Published

Typed colour registry + utilities for React Native / TypeScript

Readme

@rnzeus/harmonia

Typed colour registry + utilities for React Native / TypeScript.

Why

Design tokens tend to drift over time. You start with a clean UI kit, then designers gradually introduce random colours (different HEX / alpha variants), and your codebase ends up with a giant misc bucket.

This package helps you:

  • keep a typed palette (list) and typed aliases (aliases) using as const
  • use pick() with autocomplete (token names + palette hexes)
  • get consistent output in RN (#RRGGBBAA via .rn())
  • choose readable text colour via autoText()
  • safely handle “designer went wild” colours without leaking them into tokens

Install

yarn add @rnzeus/harmonia
# or
npm i @rnzeus/harmonia

Usage

Create a single instance in your app init (not inside JSX):

import { createColour } from '@rnzeus/harmonia';

export const MY_LIST = [
  '#6C00F6',
  '#865BFF',
  '#191919',
  '#FFFFFF',
  '#000000',
] as const;

export const MY_ALIASES = {
  primary: '#6C00F6',
  border: '#FFFFFF',
  text: '#191919',
} as const;

export const Colour = createColour({
  list: MY_LIST,
  aliases: MY_ALIASES,

  strict: __DEV__,
  debug: __DEV__,
  fallback: '#FF00FF',
});

Then anywhere:

Colour.pick('primary').rn();
Colour.pick('#865BFF').darken(0.1).rn();
Colour.mix('primary', '#FFFFFF', 0.2).rn();
Colour.contrast('text', 'primary');

Configuration

createColour() accepts a configuration object that defines how the colour system behaves.

export const Colour = createColour({
  list: MY_LIST,
  aliases: MY_ALIASES,

  // errors
  strict: __DEV__,
  fallback: '#FF00FF',
  onError: (error, context) => {
    console.warn('[Colour]', error.message, context);
  },

  // debug (one-time init log)
  debug: __DEV__,

  // autoText defaults
  textCandidates: ['#FFFFFF', '#000000'],
  textMinContrast: 4.5,
  textPrefer: 'first-pass',
});

autoText defaults

Most apps can keep the defaults, but you can customise them if needed:

export const Colour = createColour({
  list: MY_LIST,
  aliases: MY_ALIASES,

  strict: __DEV__,
  debug: __DEV__,

  // Example: prefer max contrast and allow a brand colour as candidate
  textCandidates: ['#FFFFFF', '#000000', 'primary'],
  textMinContrast: 4.5,
  textPrefer: 'max-contrast',
});

autoText usage

autoText() helps you pick a readable text colour for a given background.

By default, it chooses between #FFFFFF and #000000 using WCAG contrast (≥ 4.5).

// background can be a token or any valid hex
const text = Colour.autoText('primary').rn();

Custom candidates

You can provide your own candidates (tokens or hex values):

const text = Colour.autoText('#101010', ['text', '#FFFFFF', '#B3FF00']).rn();

Strategy & contrast threshold

const text = Colour.autoText('bg.primary', ['#FFFFFF', '#000000'], {
  prefer: 'max-contrast',
  minContrast: 4.5,
}).rn();

This is useful when:

  • designers introduce unexpected background colours
  • you want predictable readable text without adding more tokens

Debug

If debug: true, it logs one compact summary on init:

  • strict / fallback
  • tokens list
  • palette size + canonical palette (#RRGGBBAA)

License

MIT