Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a standard XML or JSON schema for color palettes? [closed]

Tags:

json

xml

colors

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.

like image 632
mwcz Avatar asked Jun 08 '11 15:06

mwcz


4 Answers

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.

like image 62
mwcz Avatar answered Oct 03 '22 22:10

mwcz


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

like image 25
amix Avatar answered Oct 03 '22 22:10

amix


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',
  ...
like image 21
Wolfgang Kuehn Avatar answered Oct 04 '22 00:10

Wolfgang Kuehn


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.

like image 28
Paul Sanwald Avatar answered Oct 03 '22 22:10

Paul Sanwald