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. How to set up and useHere'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 shapesThe 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 namesThe 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 colorsWe'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 paletteIn 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 Tweaking the colorsNow lets take a look at how the colors are specified against each shape.
Applying the TweaksWhen good to go, apply the colors to the picture 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 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. For help and more information join our forum,follow the blog or follow me on twitter .
|
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Color Fiesta >