Our house was over 25 years old when the (exterior) stucco seriously needed some patching and a new color coat. Unfortunately, the builder, who was long gone, had used his private, just-right blend of standard stucco colors, and we could not determine what that mix was. So I decided to try to match the color myself. Looking back, I wish we had just picked the closest match of the standard colors, as when you coat a whole house with a color it likely will look different than you imagined from looking at tiny samples. But I was determined to do it. So I photographed the appropriate page of the booklet of standard colors in El Rey’s sampler of 75 colors. Then I took a photograph of a typical section of our stucco wall. I took all these photos at the same time and place with the same camera and the same lighting. This was done by taping the sample color page to the wall and taking the photos at the same time. Here is a re-creation of the four sample colors I decided to work with, with the last being the current stucco color I want to find a new mix for.

I know some of these look very similar, especially #3 and #4. But if you could see it on a whole wall there would be differences. By the way, I used PaintShop to average out the color values over each sample area. Otherwise my process could fail due to a bad sampling of a color.

Now, how do we turn this into some linear equations to solve? Using PaintShop it is easy to point the cursor at a color and see the Red-Green-Blue values for that color. Each color is usually represented by a single 8-bit byte, so each color has a range from 0 to 255. In case this is new to you, note that (0,0,0) for (R,G,B) would be black, and (255,255,255) would be the brightest white.

Here are the RBG values for the four samples, plus the color I need to find a mix for. (By the way, you can insert comment lines in autorej’s input file by putting the usual Python single-line comment symbol (#) as the first character. It is a useful feature.)

#Luz |
Gray |
Coral |
Adobe |
Desired |

123 |
190 |
165 |
116 |
135 |

84 |
190 |
136 |
77 |
92 |

70 |
190 |
132 |
59 |
77 |

Want we want is the weightings for the first four colors that will reproduce the DESIRED RGB values in the last column.

So there is the linear algebra problem to solve! We just put the bottom four lines in a tab-separated file and use it as input to autorej’s P.read_problem() function. Here is the result (as a row) from P.solve():

[ 0.44108058 -0.11496714 0.32839188 0.41729469 ]

Oops! We forgot to tell autorej that the solution values must be nonnegative! Try again with P.solv_nonneg(). Here is its answer:

[ 1.09399306 0. 0.00225098 0. ]

When we look at the 3 by 5 table
earlier above we can see what is happening. The
elements of column 5 are **almost exactly 10% more** than the corresponding
elements of column 1. So basically all that is needed
is to darken column one a bit. Solve_nonneg() figured
out that the best way to do that is to add a *little bit* of the very dark
column 3.

In the interest of full disclosure, I should tell you that I couldn’t seem to find exactly the final solution that I used for actually stuccoing nearly 15 years ago, so I recreated the data here to make an appropriate example, with the same number of “input” colors and roughly the same hues. In the actual case the amount of the dark color in the computed solution was close to half of the first (which is a neutral gray). But not wanting to cause the workers extra trouble, and possibly have successive whellbarrow mixes vary due to their likely inexact mesurements, I just told the workers to mix column one and three equally. What a stupid mistake. The result was much darker than I actually wanted. It was not practical to fix, but fortunately the sun bleached it a little over the years so it still looks OK. And all the patching was good to have done. But I still would just use El Ray “Adobe” if had it to do over. The math was good, but I didn’t have the conviction to insist on an inconvenient mix. I hope I learned that lesson.