joliclic

home

XML Palette Definition

« Index [ Examples | Elements | DTD ]

Khromaxul use a simple XML format for the palettes displayed in the kh-palette element.

Some tools can be found in the kh.file JavaScript module to easily load and convert Gimp palettes in this format.

Examples

Here's the HTML4 Named Palette:

<?xml version="1.0" encoding="UTF-8"?>
<palette>
    <name>Named HTML 4 Colors</name>
    <columns>4</columns>
    <comments>
        <comment>W3C Named HTML 4 Colors</comment>
    </comments>
    <colors>
        <color r="0"   g="0"   b="0"   name="black"/>
        <color r="192" g="192" b="192" name="silver"/>
        <color r="128" g="128" b="128" name="gray"/>
        <color r="255" g="255" b="255" name="white"/>
        <color r="128" g="0"   b="0"   name="maroon"/>
        <color r="255" g="0"   b="0"   name="red"/>
        <color r="128" g="0"   b="128" name="purple"/>
        <color r="255" g="0"   b="255" name="fuchsia"/>
        <color r="0"   g="128" b="0"   name="green"/>
        <color r="0"   g="255" b="0"   name="lime"/>
        <color r="128" g="128" b="0"   name="olive"/>
        <color r="255" g="255" b="0"   name="yellow"/>
        <color r="0"   g="0"   b="128" name="navy"/>
        <color r="0"   g="0"   b="255" name="blue"/>
        <color r="0"   g="128" b="128" name="teal"/>
        <color r="0"   g="255" b="255" name="aqua"/>
    </colors>
</palette>

Elements

palette

The root element.

can contains elements:

name

The name of the palette.

can contains #PCDATA

columns

The prefered number of columns to displayed.

can contains #PCDATA (integer)

comments

can contains comment elements

comment

can contains #PCDATA

colors

can contains color elements

color

empty element

attributes:

DTD

A DTD could be:

<!ELEMENT palette - - ( name, columns?, comments?, colors? ) -- the root element -->
<!ELEMENT name - - (#PCDATA) -- the name of the palette -->
<!ELEMENT columns - - (#PCDATA) -- the prefered number of columns, integer -->
<!ELEMENT comments - - (comment*)>
<!ELEMENT comment - - (#PCDATA)>
<!ELEMENT colors - - (color*)>
<!ELEMENT color - - EMPTY>
<!ATTLIST color
  r    CDATA    #REQUIRED -- the red of the color, in [O, 255] --
  g    CDATA    #REQUIRED -- the green of the color, in [O, 255] --
  b    CDATA    #REQUIRED -- the blue of the color, in [O, 255] --
  name CDATA    #IMPLIED  -- the name of the color --
>

Khromaxul - version: 0.3alpha - 2009-07-30