Code Monkey home page Code Monkey logo

naevner's Introduction

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

Demo

Getting started

Install in a browser

Include the minified code

Install with yarn

yarn add @samhaeng/naevner

Install with NPM

npm install @samhaeng/naevner

How to use

import naevner from '@samhaeng/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:

Questions, ideas and advice

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

naevner's People

Contributors

filipjakobsen avatar rasmuswoelk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.