Socket
Socket
Sign inDemoInstall

culori

Package Overview
Dependencies
0
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    culori

Culori is a general-purpose color library for JavaScript.


Version published
Weekly downloads
155K
decreased by-17.11%
Maintainers
1
Install size
105 kB
Created
Weekly downloads
 

Readme

Source

Culori

Culori is a general-purpose color library for JavaScript.

Why I built this

There are already several excellent libraries out there for manipulating colors in JavaScript.

This library aims to provide a simple API to:

Convert between a variety of color formats.

Build a color picker for a particular format. Let's take the ubiquitous HSV color picker; the library should allow me to:

  • map the user interface for the h, s, v values to a color that I can then convert to any other format
  • for a color in any format the user can input (these will usually be the CSS Colors Level 4), obtain the representation in HSV space, so the interface can be updated accordingly

Of particular interest is deciding when to apply the alpha channel to the interface (i.e. to an opacity slider). If the interface contains color swatches, I should decide whether to use the alpha channel or not:

  • if the user inputs #ffffff I might only use the h, s and v value;
  • if the user inputs #ffffff00 I might also want to apply the a: 0 value.

Create color schemes based on a base color.

Obtain color scales to use in data visualization.

Supported formats

The library supports all the color formats defined in the CSS Colors Level 4:

Additionally, it supports:

  • HSV (also called HSB)
  • HSI
  • CubeHelix (soon)

Documentation

About the project

Culori is written by Dan Burzo and is released under the MIT License.

It builds upon the ideas of two thoroughly documented and time-tested projects: chroma.js by Gregor Aisch and d3-color by Mike Bostock.

You may also want to look at TinyColor by Brian Grinstead, color by Heather Arthur, and color.js by Andrew Brehaut et al.

FAQs

Last updated on 05 Apr 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc