Skip to main content

Use the colornames API for crowdsourced names for hex colors

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
94%
Published
3 months ago (2.0.5)

Colornames API

A simple package for interacting with the Colornames API. Colornames is a crowdsourced database of color names, with the goal of naming every possible RGB color.

import * as colornames from 'jsr:@jer/colornames'

const color = await colornames.lookup('ff0000')
color.name // -> 'Red'

const randomColor = await colornames.random()
// -> { hexCode: 'e44c4a', name: 'Makes Me Hungry Orange' }

const latest = await colornames.latest()
console.log(`#${latest[0].hexCode}: ${latest[0].name}`)
// -> #b9484b: Stale Cherry

const count = await colornames.nameCount('Lemonhead Yellow')
console.log(`Lemonhead Yellow has been proposed ${count} times.`)
// -> Lemonhead Yellow has been proposed 2 times.

All functions and types have JSDoc comments, hover over them in your editor or see the documentation for more.

If you have any questions, feel free to send me a Matrix or Discord (jerbear4328) message.

License

This package is licensed under the MIT License. If you use this package for somthing cool, please let me know!

Add Package

deno add @jer/colornames

Import symbol

import * as mod from "@jer/colornames";

Add Package

npx jsr add @jer/colornames

Import symbol

import * as mod from "@jer/colornames";

Add Package

yarn dlx jsr add @jer/colornames

Import symbol

import * as mod from "@jer/colornames";

Add Package

pnpm dlx jsr add @jer/colornames

Import symbol

import * as mod from "@jer/colornames";

Add Package

bunx jsr add @jer/colornames

Import symbol

import * as mod from "@jer/colornames";