I'd like to make color palettes available through a Web service, and am wondering if there are any standard schemas (in XML, JSON, etc) for color palettes.
Googling has not been fruitful. Do any exist, or should I roll my own?
Thanks!
Edit: something as simple as this would work:
[ 'FFFFFF', '000000', ... ]
But if there is a standard for transmitting color palettes, I'd like to go with it, even if it has more features than I need.
Update almost a year later:
I never did find an XML or JSON color palette format. Instead, I discovered Photoshop .ACO
files and GIMP's .gpl
files.
GPL is a very simple ASCII color palette file format, requiring no explanation at all. It looks like this:
GIMP Palette
Name: Power Palette
Columns: 0
#
255 0 0 Red
255 255 255 White
0 0 0 Black
ACO is a more complicated, binary format. More information on how to read/write this format here.
Converting from GPL to XML or JSON would be dead simple.
Additional possible file formats include:
See the Archive of Colour gradients for details.
Swatches and free software - Color swatch file formats has an analysis on this topic, including an overview of different XML formats in use by, both proprietary and open source, vendors. It contains examples for each format, including a view onto the binary header.
As for XML, it names these proprietary formats:
ACBL (Adobe Color Book Legacy)
ACB (AutoCAD Color Book)
QCL (QuarkXPress Color Library)
For the open source formats it lists these applications as having an XML based format:
In such a case, when you can not find a standard format, I usually recommend taking a format, that is closest to be a standard (because it is popular) or a standard for something else but is well documented. In this case, I'd go for the SOC (StarOffice Colors), since it seems to be used by OpenOffice and LibreOffice, or maybe SVG has a concept of color definition.
The website mentioned before also hosts a conversion utility for different palette formats, introducing its own XML based format, the SwatchBooker file format (.sbz):
If you are looking for named colors, consider google closure libs. Or do you want to describe the visual layout of a palette in a micro-format?
goog.provide('goog.color.names');
/**
* A map that contains a lot of colors that are recognised by various browsers.
* This list is way larger than the minimal one dictated by W3C.
*/
goog.color.names = {
'aliceblue': '#f0f8ff',
'antiquewhite': '#faebd7',
'aqua': '#00ffff',
...
I googled this also recently, and couldn't find anything, so I rolled my own using JSON, they're used on my personal homepage in the site themes section. I have an index page that lists files, which specify which JSON file to use for the theme, like here.
there's definitely room for improvement in my implementation, but I figured I would respond as I recently went through the same googling exercise and ended up rolling my own, which turned out to be really straightforward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With