9

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.

4 Answers 4

6

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:

  • cpt
  • c3g
  • ggr
  • gpf
  • inc
  • psp
  • sao
  • svg

See the Archive of Colour gradients for details.

1
  • 1
    I wrote a Windows app several years ago which deals with colours and palettes and also rolled my own file format (XML based). I also discovered Adobe swatch exchange (ASE) files (another binary format, Adobe love those) and the file format of the ColorSchemer Studio 2 Mac application. Back in 2012 when I was looking at it, nobody had documented the latter, so I investigated and documented it on my website. So there's some more for the list :-) Oct 21, 2016 at 16:08
2

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)

    • PANTONE opaque couché.acbl (Adobe Illustrator CS3)
  • ACB (AutoCAD Color Book)

    • Pantone A & I-cotton.acb (AutoCAD 2008)
  • QCL (QuarkXPress Color Library)

    • PANTONE(R) solidinhex.qcl (QuarkXPress 7.31)
    • Solid Hex UI Spec.cui (QuarkXPress 7.31)

For the open source formats it lists these applications as having an XML based format:

  • Scribus
  • sK1
  • SOC (StarOffice Colors) (OpenOffice.org, LibreOffice, etc.)

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):

2

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',
  ...
1
  • The colors I'm dealing with can be anywhere in the RGB colorspace, so there won't be a name for each of them. For the colors that DO have names, I wouldn't mind including the names, though, so goog.color.names might be useful.
    – mwcz
    Jun 8, 2011 at 15:53
1

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.

3
  • Thanks, this is close. I'd like to serve up a palette as a set of colors, "Here is a palette", but without tying each color to a particular use, like background/foreground/etc.
    – mwcz
    Jun 8, 2011 at 15:56
  • 1
    yeah, I would just make the key values more generic names, perhaps based on lightness/darkness? my implementation is admittedly very specific to what I wanted to achieve on my site. I think having a dictionary format like json is nice, but entirely up to you. Jun 8, 2011 at 16:13
  • I ended up using structuring my so that it contained an item that was a list of items, of which one key was the hex code. It allowed me to attached meta data to both the palette and the color. Sep 26, 2015 at 7:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.