.. meta:: :description property=og\:description: A Technical description of the Krita Palette format. .. metadata-placeholder :authors: - Wolthera van Hövell tot Westerflier :license: GNU free documentation license 1.3 or later. .. index:: *.kpl, KPL, Krita Palette .. _kpl_format_definition: The Krita Palette format KPL ============================ There's been a number of color swatch definitions over the years. To ensure we can store color managed color, as well as store other metadata we use, Krita has its own color palette format, KPL. This document is a technical description of the format. Basic Structure --------------- KPL files are zip files containing the following files: mimetype A text file containing the mimetype, to differentiate it from a regular zip. ``application/x-krita-palette`` colorset.xml The main color definition file. profiles.xml This is a manifest of the icc profiles that are inside the zip file. We wanted to have no ambiguity in regards to which icc files were bundled. A number of icc files. These are the necessary icc profiles for interpreting the values in colorset.xml profiles.xml ------------ A manifest of the icc profiles that are inside the zip file. We wanted to have no ambiguity in regards to which icc files were bundled. .. code:: xml Krita doesn't store every profile it uses. XYZ and LAB are colorspaces that only have one real space definition, and therefore it doesn't make sense to embed these files. colorset.xml ------------ This is the main palette definition. It can handle comments, groups and more. The top level element is a ``Colorset`` element, it's children can either be ``ColorSetEntry`` elements, or ``Group`` elements. ``ColorSetEntry`` s that are direct children of ``Colorset`` are the ungrouped colors, and are, inside Krita, referred to as the "default" group. .. code:: xml name The human friendly name of the color palette. comment The description for the palette. columns The amount of columns in the palette in total. This is the same for all groups. rows The rows of the default group, see group for more info. readonly Whether the file can be edited. version The version of the file. Group ----- ``Group`` elements can only have ``ColorSetEntry`` s as children. ``Group`` s are shown in the UI as a grid where the cells can be empty or contain a ``ColorSetEntry``. .. code:: xml name The name of the group. rows The total amount of rows this group takes up, this, together with the column value in the toplevel ``Colorset`` element, determines the grid size. ColorSetEntry ------------- .. code:: xml name The name of the color. Unlike the create swatches, we don't support translated color names. id The id value. This is for complex colorsets where there is a human friendly name, and a name that uniquely identifies the color in the swatch database. In the above example, which encodes the D65 standard illuminant at 0 stops, ``SI-D65-0EV`` is a clear unambiguous id, but "Noon daylight at 0 EV" is a much more human friendly way to refer to it. Often, the ID is used for referencing spot colors inside files. bitdepth The bitdepth at which the color should be loaded. This is largely for our own convenience. Values are `U8` (Unassigned 8bit integer), `U16` (Unassigned 16bit integer), `F16` (16 bit Floating Point), and `F32` (32 bit Floating Point). Lab and CMYK don't support `F16`, and for CMYK `F32` is not recommended because it doesn't deserialize the same way as the integer colorspaces. spot Whether or not the color is a spot color. This is currently not used elsewhere in Krita, but the intend is to use it for encoding spot colors as only the id. ``ColorSetEntry`` s have two children: The ``Position`` element is the position of the swatch inside the parent group grid. Krita doesn't store empty swatches. The other child element is a Create Swatch defintion. Krita supports `Gray`, `sRGB`, `RGB`, `XYZ`, `CMYK`, `Lab` and in theory `YCrCb`. Note that Krita supports unbounded colors as long as the bitdepth is F32. Color swatch definition from the Create Wiki: --------------------------------------------- The following is the Color Swatch definition from the `old create wiki `_ . Krita largely uses this definition. Because the Create wiki is down, it's contents are reproduced here. It is for reference only. .. code:: xml Relax-NG for the swatches ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code:: rnc namespace xlink = "http://www.w3.org/1999/xlink" grammar { start = element colors { color+, colorSpace* } color = element color { attribute name { text }, label *, (RGB ? & sRGB ? & CMYK ? & Lab ? & HSV ? & HLS ? & Luv ? & XYZ ? & Yxy ? & Gray ? & YCbCr ?) } label = element label { attribute lang { text } ?, text } spaceAttribute = attribute space { text } RGBAttributes = attribute r { xsd:float }, attribute g { xsd:float }, attribute b { xsd:float } RGB = element RGB { spaceAttribute, RGBAttributes } sRGB = element sRGB { RGBAttributes } CMYK = element CMYK { spaceAttribute, attribute c { xsd:float }, attribute m { xsd:float }, attribute y { xsd:float }, attribute k { xsd:float } } Lab = element Lab { spaceAttribute, attribute L { xsd:float }, attribute a { xsd:float }, attribute b { xsd:float } } HSV = element HSV { spaceAttribute, attribute h { xsd:float }, attribute s { xsd:float }, attribute v { xsd:float } } HLS = element HLS { spaceAttribute, attribute h { xsd:float }, attribute l { xsd:float }, attribute s { xsd:float } } Luv = element Luv { spaceAttribute, attribute L { xsd:float }, attribute u { xsd:float }, attribute v { xsd:float } } XYZ = element XYZ { spaceAttribute, attribute x { xsd:float }, attribute y { xsd:float }, attribute z { xsd:float } } Yxy = element Yxy { spaceAttribute, attribute Y { xsd:float }, attribute x { xsd:float }, attribute y { xsd:float } } YCbCr = element YCbCr { spaceAttribute, attribute Y { xsd:float }, attribute Cb { xsd:float }, attribute Cr { xsd:float } } Gray = element Gray { spaceAttribute, attribute g { xsd:float } } colorSpace = element colorspace { attribute name { text }, attribute xlink:href { xsd:anyURI } } } Using for validating -------------------- To use the above RelaxNG compact schema to validate a swatch you can use: .. code:: shell trang -I rnc -O rng colors.rnc colors.rng xmllint --relaxng colors.rng colors.xml Color Grouping Proposal ----------------------- Krita doesn't use this. .. code:: xml ...