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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@samhaeng/naevner

v1.0.5

Published

Javascript plugin that provides natural language descriptions of hex color codes.

Downloads

7

Readme

Naevner.js

Color descriptions generated from hex color codes

Javascript plugin that provides natural language descriptions of hex color codes.

Why we made this

We made this to have screenreader support for reading out color names on remembertostand.com (Turn on screenreader and press C when on the site to hear it in action)

Credits

  • The hexToRGB and RGBToHSL functions used as part of this plugin are from https://css-tricks.com/converting-color-spaces-in-javascript/

Demo

Getting started

Minified code

Include the minified code

Install with yarn

yarn add naevner

Install with NPM

npm install naevner

How to use

import naevner from 'naevner'

naevner(color);

Examples

//Examples:
naevner("#000000"); //Returns: “black”
naevner("#0000ff"); //Returns: “vivid blue”
naevner("#D6365C"); //Returns: “clear red”
naevner("#2F5651"); //Returns: “dark, faded turquoise”
naevner("#3F0548"); //Returns: “dark, clear, purpleish magenta”

Accepted values

  • 3-digit hex with preceding #-sign — e.g. #f00
  • 3-digit hex without preceding #-sign — e.g. f00
  • 6-digit hex with preceding #-sign — e.g. #ff0000
  • 6-digit hex without preceding #-sign — e.g. ff0000

Parameters

approximationSuffix

Ending for approximate colors — e.g. “greenish yellow” or “redish orange". Note that “off-white” and “black” nuances currently always use the term “-tinted” (e.g. “red-tinted black” or “yellow-tinted off-white”) independent of this parameter.

naevner(color, approximationSuffix);

approximationSuffix examples:

naevner("#3F0548");            //Returns: “dark, clear, purpleish magenta”
naevner("#3F0548", "-tinted"); //Returns: “dark, clear, purple-tinted magenta”
naevner("#3F0548", "-like");   //Returns: “dark, clear, purple-like magenta”

Other color repositories

The purpose of this plugin is to provide short, unambiguous descriptions using commonly used color terms. For some situations, different types of color descriptions may be more useful. For those situations, you may want to have a look at the following repositories. These are provided for your convenience and are not associated with this repository or Samhæng:

  • https://github.com/words/color-description

  • https://github.com/meodai/color-names

Questions, ideas and advice

If you have questions or advice, feel free to open an issue on this repo. Thank you!