Following on from Coloring maps and other shapes, here’s a bit of fun that takes the tables of Pantone colors of the year dealt with in  Selection of pantone ramps, and applies them to a piece of clip art. 


You’ll find the code in the colorize module, and the worksheet in the cDataSet.xlsm workbook. Here’s a video of it in action.

How to set up and use


Here’s how I set up the model clip art. Note that you never need to specify a color code. They are all automatically calculated in this example.

Name the shapes


The first step is to get a piece of clip art and name each of the shape components you want to color to something useful.

Update the table of useful shape names

The table of shape names will reference the original colors and the colors you want to apply to each shape. Mine look like this. You can leave the color and original color alone at this point – we are going to fill them in automatically. All data reading is done by the Data Manipulation Classes so you will see there is a blank line and a blank column after the table to delimit it.


Store the original colors

We’ll want to be able to restore the original colors. “Store current colors as original” will store the codes for each color in the original colors column against each named shape component.


Get a palette


In this case I’ve automated getting my palettes by using the Pantone fashion and home colors of the year by selecting a year, which i pick up as described in Looking up color table. You can of course set up your palette however you want. You need two columns, with the background color set to whatever the colors are you want to use.

The colors applied


Here’s what it looks like with the palette applied


Tweaking the colors


Now lets take a look at how the colors are specified against each shape.
  • You change the cell next to each shapename to a formula that references a cell in the palette that is colored the way you want.
  • So in this case, we would like the shape ‘hatTop’, to be the color ’emerald’.
  • Cell L2 is colored emerald.
  • Cell I2, which will be the color used for the shape hatTop, needs the formula hexColorOf(L2).
  • This will change the color of I2 to emerald, and also populate it with the rgb value of that color in hex, as used in web pages.
  • Tweak any other cells in the same way till you get all the colors you want.



Applying the Tweaks


When good to go, apply the colors to the picture


Restoring the original colors


Earlier you will have stored the original colors. Here’s how to restore them


How does it work?

Most of the code used here has been discussed in Selection of pantone rampsPlaying around with colors in VBALooking up color table and Coloring maps and other shapes. Here’s the code specific to this worksheet which you’ll find  in the colorize module, and the worksheet in the cDataSet.xlsm workbook.

For more about color, go here