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!
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
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!
The code uses the excellent jDataview.js from Christopher Chedeau.
Using this is very simple:
make sure you’ve loaded both the jDataview.js
and Adobe.ASE.load.js
scripts
fetch the ASE file from your web store (server) using the API call: adobe.ase.load(file, callback)
where callback
can 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 the callback.palette.arg.format.md
file for the object hierarchy/format specification.
flat_rgb_set
: a flat array containing one HTML color string in #RRGGBB
format for each color in the palette
error_msg
: optional 3rd argument which will contain an error message when something went horribly wrong. In case of errors, both palette
and flat_rgb_set
are set to null
.