|
| 1 | +.. title: Support for Color Exchange Format in Colour available! |
| 2 | +.. slug: support-for-cxf-in-colour-available |
| 3 | +.. date: 2025-09-24 10:50:00 UTC+01:00 |
| 4 | +.. tags: colour, colour science, release, cxf, colour cxf |
| 5 | +.. category: |
| 6 | +.. link: |
| 7 | +.. description: |
| 8 | +.. type: text |
| 9 | +
|
| 10 | +We are happy to announce the release of `Colour - CxF <https://github.com/colour-science/colour-cxf>`__. |
| 11 | +This extension package for Colour implements reading and writing files in the Color Exchange Format (CxF). |
| 12 | + |
| 13 | +.. TEASER_END |
| 14 | +
|
| 15 | +What is CxF? |
| 16 | +------------ |
| 17 | + |
| 18 | +CxF is a XML-based file format that provides a flexible way to store and exchange color data across different systems. |
| 19 | +It supports multiple color formats including RGB, CIELab, and spectral measurements, while providing standard ways to |
| 20 | +include metadata and descriptions about the color information. |
| 21 | + |
| 22 | +Features |
| 23 | +-------- |
| 24 | +The Colour - CxF package allows |
| 25 | + |
| 26 | +- Reading CxF documents from strings or files to a Python representation. |
| 27 | +- Writing CxF documents from the Python representation to XML strings and files. |
| 28 | +- Creating CxF objects programmatically for custom color data workflows. |
| 29 | + |
| 30 | +Getting started |
| 31 | +--------------- |
| 32 | + |
| 33 | +Install *Colour - CxF* via pip |
| 34 | + |
| 35 | +.. code-block:: bash |
| 36 | + pip install colour-cxf |
| 37 | +
|
| 38 | +or via uv |
| 39 | + |
| 40 | +.. code-block:: |
| 41 | + bashuv add colour-cfx |
| 42 | +
|
| 43 | +Then use it to read CxF data |
| 44 | + |
| 45 | +.. code-block:: python |
| 46 | + import colour_cxf |
| 47 | +
|
| 48 | + # Reading from a string |
| 49 | + xml_string = """<?xml version="1.0" encoding="UTF-8"?> |
| 50 | + <cc:CxF xmlns:cc="http://colorexchangeformat.com/CxF3-core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| 51 | + <cc:FileInformation> |
| 52 | + <cc:Creator>Colour Developers</cc:Creator> |
| 53 | + <cc:Description>Simple CxF Example</cc:Description> |
| 54 | + </cc:FileInformation> |
| 55 | + </cc:CxF>""" |
| 56 | +
|
| 57 | + # Parse the XML string |
| 58 | + cxf = colour_cxf.read_cxf(xml_string.encode("utf-8")) |
| 59 | +
|
| 60 | +# Access file information |
| 61 | +print(f"Creator: {cxf.file_information.creator}") |
| 62 | +print(f"Description: {cxf.file_information.description}") |
| 63 | + |
| 64 | +``` |
| 65 | + |
| 66 | + |
| 67 | +More Information |
| 68 | +---------------- |
| 69 | +Visit the `Colour - CxF <https://github.com/colour-science/colour-cxf>`__ repository for more information, |
| 70 | +usage examples and tutorials. |
| 71 | + |
| 72 | +Funding |
| 73 | +------- |
| 74 | +We would like to thank `NumFOCUS <https://numfocus.org>`__ |
| 75 | +for funding the work on this package through the |
| 76 | +`The Small Development Grants program <https://numfocus.org/programs/small-development-grants>`__. |
0 commit comments