Show ASE color palettes from Adobe Photoshop / Adobe Kuler
This example displays color palettes loaded from Adobe Photoshop ASE files and Adobe Kuler, rendered as a grid of 200 SVG rectangles. It uses the `adobe.ase.load` API to parse binary palette files and convert colors to `#RRGGBB` strings, then feeds the flattened array into `d3.scale.ordinal().range()` for coloring the rectangles. A dropdown menu lets users switch between built-in D3 color scales and various ASE palettes, including LAB and CMYK color space samples.
AI-generated descriptionStraight from Adobe Photoshop to D3.js �� <a href="http://bl.ocks.org/3173233" title="view this gist via bl.ocks.org">?</a> <a href="http://bl.ocks.org/GerHobbelt" title="view a list of all my gists at bl.ocks.org">8</a>
Showcases the Adobe.ASE.load.js file which can load a Photoshop ASE color palette file from the server and convert it to
both a standard JS object hierarchy (which includes the group and color names) and a flattened array which can be fed
directly to d3.scale.ordinal().range(...) for quick & easy as a color palette for d3.js visualizations.
Using this JavaScript software, you or your designer can concoct any color palette in tools such as Adobe Photoshop, place the exported Adobe ASE file on any server as a static file and you're Up & Go!
What's the use?
ZERO server-side / developer / tool effort required to convert artist-created color palettes before those are usable in your web projects, particularly when you're using D3.js to visualize your data.
Adobe Photoshop > Swatches > Save Swatches for Exchange > upload to server (static content) > use in any d3 visualization
Any hot tips?
Certainly. Get your derrière over to the Adobe Kuler web site to peruse a zillion color palettes created by the community.
And if that's not enough, there's a lot of color tools out there which produce ASE files for you to download: anyone who exports color templates for use in Photoshop is producing ASE files!
Technology
The code uses the excellent jDataview.js from Christopher Chedeau.
Using this is very simple:
make sure you've loaded both the
jDataview.jsandAdobe.ASE.load.jsscriptsfetch the ASE file from your web store (server) using the API call:
adobe.ase.load(file, callback)wherecallbackcan be any function you specify. The callback function will receive up to 3 arguments: (palette, flat_rgb_set, error_msg).palette: the JavaScript object structure which contains all the info, including color and group names, which was contained in the ASE file. See thecallback.palette.arg.format.mdfile for the object hierarchy/format specification.flat_rgb_set: a flat array containing one HTML color string in#RRGGBBformat for each color in the paletteerror_msg: optional 3rd argument which will contain an error message when something went horribly wrong. In case of errors, bothpaletteandflat_rgb_setare set tonull.