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.
This package is licensed under the MIT License. If you use this package for somthing cool, please let me know!