chroma.js

JavaScript library for all kinds of color manipulations

Subscribe to updates I use chroma.js


Statistics on chroma.js

Number of watchers on Github 4947
Number of open issues 16
Average time to close an issue 2 months
Main language CoffeeScript
Average time to merge a PR 13 days
Open pull requests 10+
Closed pull requests 9+
Last commit 9 months ago
Repo Created almost 7 years ago
Repo Last Updated 8 months ago
Size 1.83 MB
Homepage http://gka.github...
Organization / Authorgka
Latest Release1.3.5
Contributors12
Page Updated
Do you use chroma.js? Leave a review!
View open issues (16)
View chroma.js activity
View on github
Latest Open Source Launches
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating chroma.js for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Chroma.js

Chroma.js is a tiny JavaScript library (14kB) for all kinds of color conversions and color scales.

Build Status

Usage

Initiate and manipulate colors:

chroma('#D4F880').darken().hex();  // #9BC04B

Working with color scales is easy, too:

scale = chroma.scale(['white', 'red']);
scale(0.5).hex(); // #FF7F7F

Lab/Lch interpolation looks better than RGB

chroma.scale(['white', 'red']).mode('lab');

Custom domains! Quantiles! Color Brewer!!

chroma.scale('RdYlBu').domain(myValues, 7, 'quantiles');

And why not use logarithmic color scales once in your life?

chroma.scale(['lightyellow', 'navy']).domain([1, 100000], 7, 'log');

Like it?

Why not dive into the interactive documentation (there's a static version, too). You can download chroma.min.js or use the hosted version on cdnjs.com.

You can use it in node.js, too!

npm install chroma-js

Or you can use it in SASS using chromatic-sass!

Build instructions

To compile the coffee-script source files you have to run (might have to npm install first)

grunt

To run the tests simply run

npm test

And to update the documentation (thanks!), just do

npm install --global markdown-to-html http-server
cd docs/
make && make preview

Similar Libraries / Prior Art

Author

Chroma.js is written by Gregor Aisch.

License

Released under BSD license. Versions prior to 0.4 were released under GPL.

Further reading

FAQ

There have been no commits in X weeks. Is chroma.js dead?

No! It's just that the author of this library has other things to do than devoting every week of his life to making cosmetic changes to a piece of software that is working just fine as it is, just so that people like you don't feel like it's abandoned and left alone in this world to die. Bugs will be fixed. Some new things will come at some point. Patience.

chroma.js open issues Ask a question     (View All Issues)
  • about 2 years is there any method to contrast with a given color
  • about 2 years What are the input ranges for LCH?
  • about 2 years Question: how did license switch from GPL to BSD happen?
  • about 2 years The for...in in `_input.rgb` will make the rgb value become unsafe when people overwrite the Array.prototype
  • over 2 years Add CMY color space
  • over 2 years Last number in limit is smaller than the rest
  • over 2 years Feature Proposal: Get domain value from color
  • over 2 years Lab -> RGB returns negative zero
  • over 2 years Hue direction of linear interpolation in lch .
  • over 2 years uncaught typeError: r(...)[h] is not a function
  • over 2 years Generate colors based on unique values
  • over 2 years Cubehelix breaks when both lightness values are the same
  • over 2 years Quantiles broken on scale domains
  • almost 3 years Proposal: make Chroma.js immutable
  • about 3 years HCG color space
  • about 3 years Property to check if color is clipped or not
  • about 3 years Docs: Bounds of LCH
  • about 3 years Unit Tests for Converters
  • over 3 years Implement VIRIDIS colormap
  • almost 4 years using chroma-js for some colour experiments
  • almost 4 years Feature: get color at given contrast
  • about 4 years HSP color model
chroma.js open pull requests (View All Pulls)
  • HCG color space (based on HSV code)
  • Support case-insensitive colorbrewer lookups
  • Feature #36 HSP color space, and color.brightness()
  • Add viridis color map. Fix #76
  • Fixed typo
  • Corrects green test
  • Added flowtype declarations
  • Ability to call seedrandom to seed the random method
  • Changed scale() to not fail silently when out is invalid
  • fix(average): hue was averaged incorrectly
chroma.js list of languages used
chroma.js latest release notes
1.3.5 chroma 1.3.5
  • added LRGB interpolation
v1.3.3 chroma 1.3.3
  • bugfix in chroma.limits quantiles
  • bugfix when running scale.colors(1)
  • bugfix in hsi2rgb color conversion
  • added unit tests for color conversions
v1.3.1 chroma 1.3.1
Other projects in CoffeeScript