A few months ago, Firefox‘s Pocket feed provided me a link to an intriguing article about Werner’s Nomenclature of Colours. Despite the name, it is a book by Patrick Syme from two-centuries ago – recently republished by Smithsonian books– that attempted to address the problem of how to describe colors so that they can be reproduced. The work was adapted by Chicago-based designer Nicholas Rougeux, who kindly provided a spreadsheet of his data, including hex RGB values of the colors.
This problem has not gone away, though the modern solution to this problem involves calibrated ICC profiles. Even then, it also depends on the color temperature of the light source that’s bouncing off of your colored surfaces, among other factors. So, Hex RGB color values are an approximation (for an implicit sRGB ICC Color Profile) of what Patrick Syme painted in the 19th century based on Werner’s 18th century descriptions using biological and mineral reference points.
RGB color values are great for screen colors, but I wanted CMYK color values that could be used more like tints. Or at least, that’s the conceit with which I took Rougeux’s data and processed it with Adobe PDF Library slightly differently. I saved his spreadsheet as a tab-separated values file as his descriptive fields already had commas.
The Full Chart (each color has an annotation):
So let’s look at the code. The first step is to read in the TSV file:
For which we use this code:
Next, we are going to size the page based on our data. Each entry will have a quarter of a square inch, and the entire chart will be as close to square as we can make it. With this data, there will be no incomplete remainder row, but there could have been.
Then, we are going to process each entry and place each in our grid in standard top-down, left-to-right reading order.
After which, we read some data from the entry; the hex color string, the color name and a boolean value indicating whether the color is a characteristic color from which others are derived from.
And we convert the hex string to an array of integers, which we then divide by a floating point representation of 2^8-1 (aka 255.0) so that we can specify Red, Green, and Blue values as values between 0.0 and 1.0.
Then, with the Graphic state set up, we create our rectangle path, which will be stroked black if the color is a characteristic color.
However, instead of adding this path directly to the page’s content stream, we are going to add it to a Container.
The key step is that we are going to color convert the Container to the equivalent Acrobat 9 CMYK with a render intent of Absolute Colorimetric. The intent with the render intent is to convert it as precisely as possible for colors that are within or near the destination colorspace’s color gamut.
Finally, we are going to take most of the remaining fields and we are going to stick them into a Text annotation which will be displayed when a user rolls over the grid cell, but filtering out any fields that have empty values.
The end result is an entry like Siskin Green:
And below is the CMYK color corresponding to that Annotation:
While my version of the chart isn’t nearly as artistic as Rougeux’s or Syme’s, it mostly does the job. I probably should have added an intermediate step where I dig out the fill color from the converted container and also add that to the Text Annotation’s Contents. That, as they say, is left as an exercise for the reader.
Questions or comments? Leave them below. For more information on Adobe PDF Library, visit https://www.datalogics.com/products/pdf/pdflibrary/.