A KiSS Color File (KCF) contains one or more palettes. Each palette contains
16 or 256 colors (256 is typical). All palettes in a single KCF must contain the same number
of colors. For example, if the first palette in the KCF has 256 colors, all
other palettes in the KCF must also have 256 colors.
Each color in a 256 color palette can be made up of 12 bits or 24
bits. Nowadays, the most common format is a 256 color palette with 24-bit
colors.
KCFs are associated with cel images, where the colors for one or more
cels comes from one palette in the specified KCF. For example, If there
are twenty cels, they could all share the same palette from one KCF or
they could each have a unique palette in twenty separate KCFs.
Where things get interesting is when a set changes which palette to use
from each KCF. This is typically done through the viewer's user interface
but FKiSS has an action,
changecol(),
that accomplishes this from within an FKiSS script. A set is a collection
of objects and each object is made of one or more cels. A set uses a
palette in each KCF. If a KCF has five palettes, a set could choose one
of those five palettes to use for display. Change the palette associated
with the set and all the cels in that set can change color.
The tricky part is when cels uses multiple KCFs. If a set is
associated with a palette number, all KCFs should have that palette in
their collection of palettes. However, this is often not the case, mainly
because it can be challenging to create that many palettes across many
KCFs. So the rule for KCFs is the first palette in a KCF is used to "fill
out" that KCF if it does not have enough palettes to match the number or
palettes in another KCF.
For example, given two KCFs. The first KCF has two palettes and the
second KCF has three palettes. A set could be associated with any of three
palettes, because the second KCF has three possible palettes even though
the first KCF has only two. If a set uses the third palette, all cels
associated with the second KCF use the third palette for display. However,
all cels that are associated with the first KCF do not have a third
palette. In this situation, the viewer always uses the first palette to
make up for the missing palette.
If there are multiple KCFs and they contain different numbers of
palettes then the KCFs with fewer palettes are filled to match the one
with the most using copies of their first palette. Originally, the KCF was
expected to contain up to 10 palettes, however some modern viewers are
more flexible in how they handle palettes, allowing more than 10 palettes
in a single KCF (the KCF specification, detailed below, can support up to
65,535 palettes in a single KCF).
In palette-based images, color 0 from the palette is not used in a cel.
That is because a pixel using color 0 is considered transparent and allows
the background to show through (see the section on
Transparency and Translucency
in the CEL file details).
Color 0 from palette 0 file is special in that it is used as the
background color of the play field.