cmapkit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. cmapkit-0.1.0/LICENSE +21 -0
  2. cmapkit-0.1.0/NOTICE +34 -0
  3. cmapkit-0.1.0/PKG-INFO +363 -0
  4. cmapkit-0.1.0/README.md +332 -0
  5. cmapkit-0.1.0/cmapkit/__init__.py +17 -0
  6. cmapkit-0.1.0/cmapkit/_machado.py +50 -0
  7. cmapkit-0.1.0/cmapkit/bounds.py +257 -0
  8. cmapkit-0.1.0/cmapkit/calibrate.py +181 -0
  9. cmapkit-0.1.0/cmapkit/hdrmaps/__init__.py +33 -0
  10. cmapkit-0.1.0/cmapkit/hdrmaps/curve.py +313 -0
  11. cmapkit-0.1.0/cmapkit/hdrmaps/data/maps.json +746 -0
  12. cmapkit-0.1.0/cmapkit/hdrmaps/library.py +130 -0
  13. cmapkit-0.1.0/cmapkit/hdrmaps/measure.py +62 -0
  14. cmapkit-0.1.0/cmapkit/hdrmaps/noise.py +176 -0
  15. cmapkit-0.1.0/cmapkit/hdrmaps/paths.py +143 -0
  16. cmapkit-0.1.0/cmapkit/mccp/__init__.py +6 -0
  17. cmapkit-0.1.0/cmapkit/mccp/data/palettes.json +5782 -0
  18. cmapkit-0.1.0/cmapkit/mccp/figures.py +222 -0
  19. cmapkit-0.1.0/cmapkit/mccp/optimise.py +914 -0
  20. cmapkit-0.1.0/cmapkit/mccp/order.py +124 -0
  21. cmapkit-0.1.0/cmapkit/mpl.py +180 -0
  22. cmapkit-0.1.0/cmapkit/space.py +314 -0
  23. cmapkit-0.1.0/cmapkit.egg-info/PKG-INFO +363 -0
  24. cmapkit-0.1.0/cmapkit.egg-info/SOURCES.txt +33 -0
  25. cmapkit-0.1.0/cmapkit.egg-info/dependency_links.txt +1 -0
  26. cmapkit-0.1.0/cmapkit.egg-info/requires.txt +17 -0
  27. cmapkit-0.1.0/cmapkit.egg-info/top_level.txt +1 -0
  28. cmapkit-0.1.0/pyproject.toml +41 -0
  29. cmapkit-0.1.0/setup.cfg +4 -0
  30. cmapkit-0.1.0/tests/test_cache.py +54 -0
  31. cmapkit-0.1.0/tests/test_figures.py +43 -0
  32. cmapkit-0.1.0/tests/test_hdrmaps.py +230 -0
  33. cmapkit-0.1.0/tests/test_mpl.py +131 -0
  34. cmapkit-0.1.0/tests/test_optimise.py +175 -0
  35. cmapkit-0.1.0/tests/test_space.py +77 -0
cmapkit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 David Lister
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
cmapkit-0.1.0/NOTICE ADDED
@@ -0,0 +1,34 @@
1
+ MCCP includes data derived from third-party work:
2
+
3
+ mccp/_machado.py
4
+ Colour-vision-deficiency simulation matrices of Machado, Oliveira and
5
+ Fernandes (2009), "A physiologically-based model for simulation of color
6
+ vision deficiency", IEEE TVCG 15(6), 1291-1298, as tabulated in
7
+ colour-science (https://www.colour-science.org) under the BSD 3-Clause
8
+ licence:
9
+
10
+ Copyright 2013 Colour Developers
11
+
12
+ Redistribution and use in source and binary forms, with or without
13
+ modification, are permitted provided that the following conditions are
14
+ met:
15
+ 1. Redistributions of source code must retain the above copyright notice,
16
+ this list of conditions and the following disclaimer.
17
+ 2. Redistributions in binary form must reproduce the above copyright
18
+ notice, this list of conditions and the following disclaimer in the
19
+ documentation and/or other materials provided with the distribution.
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmapkit-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,363 @@
1
+ Metadata-Version: 2.4
2
+ Name: cmapkit
3
+ Version: 0.1.0
4
+ Summary: Colour maps designed in CAM16-UCS: categorical palettes whose closest pair is as distinct as possible, and long maps for images of high dynamic range, both for colour-blind readers too
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/DavidLister/cmapkit
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Scientific/Engineering :: Visualization
11
+ Classifier: Framework :: Matplotlib
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ License-File: NOTICE
16
+ Requires-Dist: numpy>=1.24
17
+ Requires-Dist: scipy>=1.10
18
+ Provides-Extra: matplotlib
19
+ Requires-Dist: matplotlib>=3.7; extra == "matplotlib"
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest; extra == "test"
22
+ Requires-Dist: colour-science; extra == "test"
23
+ Requires-Dist: matplotlib>=3.7; extra == "test"
24
+ Provides-Extra: bench
25
+ Requires-Dist: matplotlib; extra == "bench"
26
+ Requires-Dist: colour-science; extra == "bench"
27
+ Requires-Dist: colorspacious; extra == "bench"
28
+ Requires-Dist: glasbey; extra == "bench"
29
+ Requires-Dist: qualpal; extra == "bench"
30
+ Dynamic: license-file
31
+
32
+ # cmapkit
33
+
34
+ cmapkit is a Python package for designing colour maps in CAM16-UCS, a colour
35
+ space in which equal distances look equally different. Version 0.1 contains
36
+ two methods. The first, MCCP (maximum contrast colour picking), chooses the
37
+ colours of a categorical plot. Given the number of data series N, it chooses N
38
+ colours so that the two least distinct colours are as distinct as its
39
+ optimiser can make them. The colours are chosen for that N and for the
40
+ background of the plot. They are also kept apart for readers with the common
41
+ deficiencies of colour vision, to a stated fraction of the separation that
42
+ normal vision receives. cmapkit works with matplotlib.
43
+
44
+ The first figure below compares a palette of seven colours from MCCP, on
45
+ white, with six common palettes, of which the longer ones give their first
46
+ seven colours. Each disc holds every colour of a palette once in each ring,
47
+ arranged so that every pair of colours meets at least twice
48
+ ([docs/test-figures.md](https://github.com/DavidLister/cmapkit/blob/main/docs/test-figures.md)). The rows show normal vision
49
+ and simulated deutan, protan and tritan vision. The number under each disc is
50
+ the least colour difference between two colours of the palette for that
51
+ observer, in the measure that MCCP maximises, so that the comparison favours
52
+ MCCP by construction; [docs/results.md](https://github.com/DavidLister/cmapkit/blob/main/docs/results.md) compares the
53
+ palettes under other measures. MCCP's colours are the most distinct for
54
+ normal, deutan and protan vision. For tritan vision, to which it gives a
55
+ lower priority (Section 3), its least difference of 12.7 is close to those
56
+ of tab10 and Okabe–Ito and below the 21.2 of petroff10. The second figure
57
+ shows the default palettes for N from 3 to 30. `tools/palette_rings.py` draws
58
+ the first.
59
+
60
+ ![Palettes of seven colours on white, from MCCP and six common palettes, as ring discs in normal vision and in simulated deutan, protan and tritan vision, with the least colour difference under each](https://raw.githubusercontent.com/DavidLister/cmapkit/main/docs/img/rings_compare.png)
61
+
62
+ ![Default palettes for N from 3 to 30 on white (left), and palettes for normal vision only (right)](https://raw.githubusercontent.com/DavidLister/cmapkit/main/docs/img/srgb_palettes.png)
63
+
64
+ The second method, hdrmaps, is experimental. It gives long colour maps for
65
+ images of high dynamic range, such as electron micrographs, that are uniform
66
+ in contrast for normal and colour-deficient vision, with a length that can
67
+ be matched to the noise of the image. It is described in
68
+ [docs/hdrmaps.md](https://github.com/DavidLister/cmapkit/blob/main/docs/hdrmaps.md). The first figure below shows the two
69
+ shipped maps, path10 and path20, beside three established maps, in normal
70
+ vision and in simulated protan, deutan and tritan vision.
71
+
72
+ ![The shipped maps and three references, as seen in normal vision and in simulated protan, deutan and tritan vision](https://raw.githubusercontent.com/DavidLister/cmapkit/main/docs/img/hdrmaps.png)
73
+
74
+ The second figure, a variant of the test image of Kovesi (2015), shows how
75
+ plainly each map shows a small difference in the data. In each band the data
76
+ rise from left to right and carry a sine of constant amplitude, 0.01 of the
77
+ range, whose period halves in ten strips from 1024 pixels at the top to 2 at
78
+ the bottom. In the lower half of each strip but the last, its sine fades out
79
+ as that of the next fades in, so that one strip passes into the next without
80
+ an edge. The colour difference by which a map shows the sine is proportional
81
+ to its speed there, the colour difference per unit of data, so a uniform map
82
+ shows it equally plainly across the band, and a long map shows it more plainly
83
+ than a short one. Turbo shows the sine most plainly at its blue end, where its
84
+ speed is about 400, and least in its green middle, where it is about 150 (in
85
+ normal vision); grey and cividis are nearly uniform, but at about 110 they
86
+ show it faintly throughout. The eye sees the sine most plainly at the middle
87
+ periods. In the strips of shortest period it averages the sine away, as it
88
+ averages the noise of an image, and sees the mean colour; in those of longest
89
+ period the sine is a slow change that it hardly notices. The bands are 2048
90
+ pixels wide, and the figure should be viewed at full size
91
+ (`tools/hdrmaps_figures.py` draws both figures).
92
+
93
+ ![Small differences shown by each map: a ramp carrying a sine of constant amplitude, in strips of shorter period from the top of each band](https://raw.githubusercontent.com/DavidLister/cmapkit/main/docs/img/hdrmaps_ripple.png)
94
+
95
+ The package is at the alpha stage (version 0.1.0), and its interface
96
+ may change.
97
+
98
+ ## 1. Installation
99
+
100
+ ```
101
+ pip install cmapkit
102
+ ```
103
+
104
+ cmapkit requires numpy and scipy. The matplotlib helpers also require
105
+ matplotlib, which `pip install "cmapkit[matplotlib]"` installs with it. The
106
+ version under development is installed with
107
+ `pip install git+https://github.com/DavidLister/cmapkit`.
108
+
109
+ ## 2. Use
110
+
111
+ ```python
112
+ import cmapkit
113
+
114
+ pal = cmapkit.palette(8) # eight colours for a white background
115
+ pal.hex # ['#...', ...]
116
+ pal.min_distance # least distance between two colours
117
+
118
+ cmapkit.palette(8, background="#000000") # for a black background
119
+ cmapkit.palette(8, order="contrasting") # neighbours as different as possible
120
+ ```
121
+
122
+ With matplotlib:
123
+
124
+ ```python
125
+ import matplotlib.pyplot as plt
126
+
127
+ cmapkit.use(8) # colour cycle for figures drawn from now on
128
+
129
+ fig, ax = plt.subplots()
130
+ for y in data:
131
+ ax.plot(y, label=...)
132
+ ax.legend()
133
+ cmapkit.recolor(ax) # recolour the series already drawn, and the legend
134
+ ```
135
+
136
+ `use` takes the background from the current matplotlib style. `recolor`
137
+ takes it from the axes, and accepts a list of axes or a whole figure, so that
138
+ series on twin axes or several panels are coloured together.
139
+
140
+ With default settings, palettes with N from 1 to 50 on white, black and
141
+ #333333 (a common dark-grey plot background) are precomputed and are
142
+ returned at once. Other palettes are computed when asked for, which takes
143
+ from a few seconds at small N to one or two minutes at N = 50.
144
+
145
+ The functions above belong to MCCP and are also available as `cmapkit.mccp`,
146
+ for example `cmapkit.mccp.palette`. The colour space, observers and lightness
147
+ limits (`cmapkit.space`, `cmapkit.bounds`) are shared with hdrmaps.
148
+
149
+ For an image of high dynamic range:
150
+
151
+ ```python
152
+ import matplotlib.pyplot as plt
153
+ import cmapkit.hdrmaps as hdr
154
+
155
+ rgb, details = hdr.render(image) # 'path20', no blur
156
+ plt.imshow(rgb)
157
+
158
+ cmap = hdr.colormap("path10") # a matplotlib colormap
159
+ plt.imshow(hdr.scale(image, "sqrt"), cmap=cmap)
160
+ ```
161
+
162
+ `render` returns sRGB values in [0, 1], and in `details` the noise of the
163
+ image, the blur applied in pixels (none unless `blur` is given) and the length
164
+ of the map. A colour map from `colormap` is applied to the image after
165
+ `scale`, which clips it at the 0.1 and 99.9 percentiles and takes its square
166
+ root, as `render` does. Section 8 of [docs/hdrmaps.md](https://github.com/DavidLister/cmapkit/blob/main/docs/hdrmaps.md) gives
167
+ the other functions, and `tools/compare_images.py` compares two maps on an
168
+ image.
169
+
170
+ ## 3. Method
171
+
172
+ Fixed palettes such as matplotlib's tab10 have a set number of colours K. If
173
+ a plot has more series than K, colours repeat. If it has fewer, the first N
174
+ colours are used, and these are not the best set of N. MCCP computes a set
175
+ for each N.
176
+
177
+ Colour difference is measured in CAM16-UCS (Li et al. 2017). Lightness
178
+ differences are divided by K_L = 0.77, the lightness weight that Luo et
179
+ al. (2006) fitted to large colour differences. Without it, pairs differing
180
+ mainly in lightness looked more distinct, and pale pairs of equal lightness
181
+ less distinct, than the measure predicted, when test figures were inspected
182
+ by eye.
183
+
184
+ A colour is admitted only if it shows well against the background. How light
185
+ or dark a colour may be depends on its hue: yellows and greens can be light,
186
+ blues and violets dark. This follows the shape of the range of colours a
187
+ screen can show. These limits were judged by eye (Section 4).
188
+
189
+ About 8 % of men and 0.4 % of women of European descent have a red–green
190
+ deficiency of colour vision (Birch 2012). MCCP simulates the three kinds of
191
+ dichromat (Machado et al. 2009):
192
+
193
+ - deutans and protans, who lack the medium- or the long-wavelength cones;
194
+ - tritans, who lack the short-wavelength cones, which is rare.
195
+
196
+ Each simulated observer must see every pair of colours at least a stated
197
+ fraction of the separation required for normal vision: 0.6 for deutans and
198
+ protans, and 0.2 for tritans, because tritan deficiency is rare. Requiring
199
+ the full separation for every observer confines a palette to lightness and
200
+ blue–yellow differences. The fraction 0.6 keeps most of the separation for
201
+ normal vision.
202
+
203
+ MCCP maximises the least separation by numerical optimisation and then
204
+ spreads apart the colours that do not limit it. The colours are rounded to
205
+ 8-bit values. The formulation and method are given in
206
+ [docs/design.md](https://github.com/DavidLister/cmapkit/blob/main/docs/design.md).
207
+
208
+ ## 4. Calibration
209
+
210
+ The lightness limits were judged by the author on an LG DualUp monitor in a
211
+ moderately lit room, on white, black and #333333 backgrounds. The monitor was
212
+ in a wide-gamut (DCI-P3) mode at the time, which showed colours somewhat more
213
+ saturated than a standard sRGB display does. On two sRGB monitors the charts
214
+ and palettes looked very similar; docs/calibration.md estimates the
215
+ effect. For other
216
+ backgrounds the limits are interpolated in the background's lightness, and
217
+ MCCP warns when this happens for a mid-tone background, where the
218
+ interpolation is least certain. `diagnostics["bounds"]` states which applies.
219
+ The procedure and the measured values are given in
220
+ [docs/calibration.md](https://github.com/DavidLister/cmapkit/blob/main/docs/calibration.md),
221
+ with instructions for calibrating another background or display.
222
+
223
+ ![A ten-colour palette on black](https://raw.githubusercontent.com/DavidLister/cmapkit/main/docs/img/mccp10_srgb_cvd_black.png)
224
+
225
+ The figure shows a ten-colour palette on black, as seen with normal vision
226
+ (top row) and by the three simulated dichromats. In each row:
227
+
228
+ - left: a ring figure, in which every pair of colours touches twice
229
+ ([docs/test-figures.md](https://github.com/DavidLister/cmapkit/blob/main/docs/test-figures.md));
230
+ - centre: the six closest pairs, with their distances;
231
+ - right: a sample plot.
232
+
233
+ `cmapkit.mccp.figures.report_figure` draws it for any palette.
234
+
235
+ ## 5. Results
236
+
237
+ At N = 10 on white, compared with matplotlib's tab10:
238
+
239
+ - the closest pair in the default MCCP palette is 1.6 times as far apart in
240
+ MCCP's own measure, and 1.5 times in OKLab (Ottosson 2020), a colour space
241
+ that neither palette was designed in;
242
+ - for a simulated deuteranope, it is 4.7 times as far apart;
243
+ - its least contrast ratio with white is lower: 1.3 against 2.0.
244
+
245
+ tab10 was designed for other qualities, such as moderate colourfulness, so
246
+ the comparison favours MCCP.
247
+
248
+ The default palettes give up some separation for normal vision in exchange
249
+ for separation for colour-deficient readers. For N from 3 to 30, normal
250
+ vision keeps 81 to 99 % of the separation it has when MCCP designs for
251
+ normal vision alone (`observers=[]`). The least separation for deutans and
252
+ protans stays at 0.6 of the normal-vision separation, against 0.02 to 0.44
253
+ for those normal-vision-only palettes.
254
+
255
+ The palette generators glasbey and Qualpal design for normal vision alone by
256
+ default. MCCP's defaults are ahead of them in MCCP's own measure at 12 to 14
257
+ of 14 values of N. Part of that lead is built in, since the measure's
258
+ lightness weight was chosen by the same eye that judged the palettes. In
259
+ OKLab, MCCP's defaults are ahead of Qualpal but behind glasbey. In the
260
+ measures that glasbey and Qualpal optimise, those programs lead. For
261
+ simulated deuteranopes, MCCP's least separation is four to eight times
262
+ larger (median over N), although Qualpal's default is ahead at 2 of 14
263
+ values. Against glasbey's colour-blind-safe mode, MCCP's defaults are ahead
264
+ in nearly every measure at every N from 3 to 12.
265
+
266
+ These figures are distances in models of colour difference. They have not
267
+ been tested in a study of readers.
268
+ [docs/results.md](https://github.com/DavidLister/cmapkit/blob/main/docs/results.md)
269
+ gives the comparisons in full.
270
+
271
+ ## 6. Options
272
+
273
+ | Argument | Meaning |
274
+ |---|---|
275
+ | `n` | Number of colours. |
276
+ | `background` | Background colour, as `'#rrggbb'`, a matplotlib name, or an RGB triple. Default white. |
277
+ | `text` | Colour of text and axes, kept clear of. Default black on light backgrounds, white on dark ones. |
278
+ | `order` | None (the default): no particular order. `'similar'`: neighbouring colours alike. `'contrasting'`: neighbours as different as possible. An integer G: groups of G colours, each well separated, for example to pair with line styles. |
279
+ | `observers` | Simulated observers, for example `[cmapkit.Observer("deutan", 1.0, 0.6)]`: type, severity from 0 to 1, and fraction of the normal-vision separation guaranteed. `[]` designs for normal vision alone. |
280
+ | `radii` | One number per colour. A colour with a larger radius is kept further from the others and from the background. |
281
+ | `fixed` | Colours already in use, which the new colours are kept apart from. |
282
+ | `anchors` | Further colours to keep clear of, each `cmapkit.Anchor(colour, clearance)`, added to the background and text anchors (clearances 20 and 15). `replace_anchors=True` replaces those. |
283
+ | `mode` | `'auto'` (the default, currently the same as `'srgb'`), `'srgb'`, or `'standard'`. The standard mode uses unweighted CAM16-UCS, one lightness limit for all hues, and normal vision only unless observers are given. |
284
+
285
+ Each palette carries `min_distance`, the least distance between two of its
286
+ colours for normal vision, and `diagnostics`, which include:
287
+
288
+ - the least distance for each observer;
289
+ - the scale achieved, which is the least distance divided by twice the
290
+ observer's fraction;
291
+ - the pairs and conditions that limit it;
292
+ - the source of its lightness limits.
293
+
294
+ ## 7. Limitations
295
+
296
+ - The lightness limits rest on one observer. They were measured on one display
297
+ in a wide-gamut mode and checked on two sRGB monitors. Backgrounds other
298
+ than white, black and #333333 use interpolated limits not checked by eye.
299
+ - No measure of colour difference has been validated for differences as
300
+ large as those between palette colours.
301
+ - To keep colours distinct, MCCP admits colours of low luminance contrast
302
+ with the background when they remain clearly visible, such as bright green
303
+ on white. On white, the least contrast ratio is 1.25 to 1.37 at every N
304
+ tested (tab10: 2.0 to 2.5). This is well below the 3 to 1 that the Web
305
+ Content Accessibility Guidelines (W3C 2018) ask for graphical objects.
306
+ - The optimum found is local. Different starting points give results within
307
+ about 1 % of one another.
308
+ - `recolor` handles lines and single-colour scatter plots. Error bars, bars,
309
+ histograms, filled areas, box plots and colour-mapped scatter plots are
310
+ refused.
311
+ - Palettes may differ slightly between platforms. They are reproducible for
312
+ the same inputs, package version and platform.
313
+
314
+ ## 8. Related work
315
+
316
+ Several programs maximise the least distance between colours for any N,
317
+ among them Qualpal (Larsson 2025), glasbey (McInnes) and maxdistcolor for
318
+ MATLAB. MCCP differs from them in three ways:
319
+
320
+ - its lightness-weighted CAM16-UCS measure;
321
+ - its lightness limits by hue for each background;
322
+ - its guarantees for simulated colour-deficient observers.
323
+
324
+ [docs/prior-work.md](https://github.com/DavidLister/cmapkit/blob/main/docs/prior-work.md)
325
+ reviews earlier work.
326
+
327
+ ## 9. Use of AI
328
+
329
+ The code, tests, benchmarks and documentation, including the review of the
330
+ literature, were written by an AI system (Claude, from Anthropic) under the
331
+ author's direction. The author set the aims, chose among the alternatives
332
+ proposed, supplied the papers, made every visual judgement (the calibration,
333
+ and the comparisons by eye reported in docs/results.md), reviewed the
334
+ results, and read the code before its release. Citations were checked
335
+ against the sources by the AI system where these were available; those not
336
+ confirmed are marked in docs/prior-work.md. The CAM16
337
+ implementation is tested against the colour-science package.
338
+
339
+ ## References
340
+
341
+ - Birch, J. (2012). Worldwide prevalence of red-green color deficiency.
342
+ Journal of the Optical Society of America A 29(3), 313–320.
343
+ - Kovesi, P. (2015). Good colour maps: how to design them. arXiv:1509.03700.
344
+ - Larsson, J. (2025). Qualpal: qualitative color palettes for everyone.
345
+ Journal of Open Source Software 10(114), 8936.
346
+ - Li, C., Li, Z., Wang, Z., Xu, Y., Luo, M. R., Cui, G., Melgosa, M., Brill,
347
+ M. H., and Pointer, M. (2017). Comprehensive color solutions: CAM16, CAT16,
348
+ and CAM16-UCS. Color Research and Application 42(6), 703–718.
349
+ - Luo, M. R., Cui, G., and Li, C. (2006). Uniform colour spaces based on
350
+ CIECAM02 colour appearance model. Color Research and Application 31(4),
351
+ 320–330.
352
+ - Machado, G. M., Oliveira, M. M., and Fernandes, L. A. F. (2009). A
353
+ physiologically-based model for simulation of color vision deficiency.
354
+ IEEE Transactions on Visualization and Computer Graphics 15(6), 1291–1298.
355
+ - Ottosson, B. (2020). A perceptual color space for image processing. Web
356
+ article, https://bottosson.github.io/posts/oklab/.
357
+ - W3C (2018). Web Content Accessibility Guidelines (WCAG) 2.1.
358
+
359
+ ## Licence
360
+
361
+ MIT. See [LICENSE](https://github.com/DavidLister/cmapkit/blob/main/LICENSE).
362
+ [NOTICE](https://github.com/DavidLister/cmapkit/blob/main/NOTICE) lists
363
+ third-party data included in the package.