Wes Anderson palettes for javascript
Color palettes based on Wes Anderson movies, taken from Karthik Ram's wesanderson package for R, the first round of palettes of which were derived from the Wes Anderson Palettes Tumblr.
Installation
You could grab the files directly from the github repository:
wesanderson.js
and
wesanderson.css.
Or you could clone the git repository:
git clone git://github.com/kbroman/wesandersonJS
Or, you can use bower:
bower install wesanderson
You'll then find the wesanderson.js file in
bower_components/wesanderson/wesanderson.js.
Usage
Javascript palettes
wesanderson.js
contains two things:
-
wes_palettes– an object indexed by palette name, containing arrays of colors. For example,wes_palettes["Rushmore"]gives an array of 5 colors from the movie Rushmore. -
wes_palette– a function to be called with a color palette name and (optionally) some number of colors. For example,wes_palette("Rushmore", 2)will give you the first two colors in theRushmorepalette.
CSS
wesanderson.css
is organized like the
colorbrewer.css
file that is distributed with D3. For each palette, it defines a set
of classes like:
.Rushmore.q0{fill:rgb(225,189,109)}
.Rushmore.q1{fill:rgb(234,190,148)}
.Rushmore.q2{fill:rgb(11,119,94)}
.Rushmore.q3{fill:rgb(53,39,74)}
.Rushmore.q4{fill:rgb(242,48,15)}Assign classes like q0, q1, q2, ..., to the elements you wish to
be filled, and then set a class like Rushmore to a parent element,
such as the SVG.
D3 scales
wes_scales.js contains some D3 scales similar to
d3.scale.category10().
var cscale = d3.scale.Rushmore();
cscale.domain(["foo", "bar", "baz"]);License
Licensed under the MIT license. (More information here.)
