GithubHelp home page GithubHelp logo

isabella232 / nearest-color-shade Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cultureamp/nearest-color-shade

0.0 0.0 0.0 12 KB

JavaScript utility to identify the brand color and tint (white added) or shade (black added) of a CSS color value

License: MIT License

JavaScript 100.00%

nearest-color-shade's Introduction

Nearest Color Shade

Snaps a CSS color value to a set of brand colours and identifies the required tint (added white) or shade (added black) to achieve the best match.

Installation

npm install -g nearest-color-shade

Usage

From the command line:

$ nearest-color-shade "#ff0000"
{ color: '$ca-palette-coral', tint: 0.3 }

In Node:

var nearest = require('nearest-color-shade');
var Color = require('color');
var colors = {
  brandRed: Color('red'),
  brandGreen: Color('green'),
  brandBlue: Color('blue'),
};

nearest(colors, Color('#FF8080'));
// => { color: 'brandRed', tint: 0.5 }

Configuration

Out of the box, nearest-color-shade's command line interface is configured with Culture Amp's brand colors, but you can override this with a nearest-color.json in your home directory.

{
  "brandRed": "#FF0000",
  "brandGreen": "#00FF00",
  "brandBlue": "#0000FF"
}

Why does this exist?

Culture Amp Front End engineers often receive designs with exact color values, but our style guide requires that these be implemented as a pure brand color plus a percentage of white or black.

This tool makes it easy to identify the intended implementation for a specified output color.

nearest-color-shade's People

Contributors

sentience 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.