A Python library for reading, manipulating, and writing Color Exchange Format (CxF) files.
Colour CxF provides tools for working with CxF files, which are XML-based files used for exchanging color information between different applications and devices. The library allows you to:
- Read CxF files from strings or files
- Access and manipulate color data in various formats (RGB, CIELab, spectral)
- Create CxF objects programmatically
- Write CxF objects to XML strings
Colour - CxF requires some dependencies in order to run:
Once the dependencies are satisfied, Colour - CxF can be installed from the Python Package Index by issuing this command in a shell:
pip install --user colour-cxf
The overall development dependencies are installed as follows:
pip install --user 'colour-cxf[development]'
Using uv you can simply install Colour - CxF via:
uv add colour-cxf
import colour_cxf
# Reading from a string
xml_string = """<?xml version="1.0" encoding="UTF-8"?>
<cc:CxF xmlns:cc="http://colorexchangeformat.com/CxF3-core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<cc:FileInformation>
<cc:Creator>Colour Developers</cc:Creator>
<cc:Description>Simple CxF Example</cc:Description>
</cc:FileInformation>
</cc:CxF>"""
# Parse the XML string
cxf = colour_cxf.read_cxf(xml_string.encode("utf-8"))
# Access file information
print(f"Creator: {cxf.file_information.creator}")
print(f"Description: {cxf.file_information.description}")
For more detailed information and examples, see the tutorial.
Colour CxF is licensed under the BSD-3-Clause license.