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.Following on from
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.
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.
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.
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.
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.
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.
Here's what it looks like with the palette applied
Now lets take a look at how the colors are specified against each shape.
When good to go, apply the colors to the picture
Earlier you will have stored the original colors. Here's how to restore them
Most of the code used here has been discussed in Selection of pantone ramps, Playing around with colors in VBA, Looking 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.
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Color Fiesta >