### Creating one color ramp from another

 Lets say that we want to create a circular color ramp, as used in How to create a heatmap doughnut chart, as in the example shown belowThis is actually 2 steps, using this dataUse the values for each category to create target colors. For example, "ice cream" has the highest spend in the first category, whereas "fruit" has the highest in the second. The target colors for each category midpoint are calculated using these values, meaning that "ice cream, category 1" gets a slightly less intense color than "fruit, category 2" and so on.Now we have to calculate the color ramp for intermediate steps between each of these midpoints. Since the colorramp library provides the capability to pass  custom colors, we can simply use the midpoint colors created in step 1 to generate a colorramp between them.Here are the calculated colorsSo the task is now to calculate a smooth transition between each of these colors and to circle back from Chips to Vegetables, where each transition is centered around the calculated color for each category, as belowhere's the snippet for that`' and the target colors based on the values`` For j = LBound(aColors, 2) To UBound(aColors, 2)``   For i = 1 To ds.rows.count``    aColors(i + 1, j) = _ ``      rampLibraryRGB(colorRampName, mn, mx, ds.value(i, j), brighten)``   Next i``' for cycling - add the last color at beginning and first color at end``   aColors(1, j) = aColors(1 + ds.rows.count, j)``   aColors(2 + ds.rows.count, j) = aColors(2, j)`` Next j`Since each slice of the doughnut is now of equal size, (remember we are using color instead of size to show intensity), the color of each slice is calculated by its relative position along this circular scale, as per the snippet below` ' dealing with this point``   o = (i - 1) * granularity + j + 1``' note we are already half a granularity along with 1st point``  props = makeColorProps(colorRamp _``    (1, (granularity * (ds.rows.count + 1)), o + granularity / 2, _``           extractArrayItem(aColors, k)))`Here's the complete code for the module that creates the chart.`For help and more information join our forum,follow the blog or follow me on twitter .``Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly. If you prefer Video style learning I also have two courses available. also published by O'Reilly. Google Apps Script for Developers and Google Apps Script for Beginners.JOT_postEvent('registerForRpc', this, ['-3712903026592331065', 1372663106, '//2k026imuihnrho207b8ideld4uc88ppu-a-sites-opensocial.googleusercontent.com/gadgets/ifr?url\x3dhttps://storage.googleapis.com/goinggas.com/public/hosting/sites/xliberation/xml/sitesense.xml\x26container\x3denterprise\x26view\x3ddefault\x26lang\x3den\x26country\x3dALL\x26sanitize\x3d0\x26v\x3d9ab5f6e4d805d588\x26libs\x3dcore:dynamic-height\x26mid\x3d77\x26parent\x3dhttp://www.mcpher.com/Home/excelquirks/colorfiesta/heatmap/lib/rampfromanother#up_client\x3dca-pub-0073976545556837\x26up_slot\x3d5457792947\x26st\x3de%3DAIHE3cA1QQnPvWdelWoW6YYHqW5UQWftOyGw0HtgYUTY1lt%252BbPR41txByC%252FBXaURi1m9yci3UHkcLag3f1G6vTiyFAuwMyhKjGxdiaN88q16a4w7gAtmxPJlKohbXBOefZ3F%252FojmjQoB%26c%3Denterprise\x26rpctoken\x3d-3712903026592331065'])JOT_postEvent('registerForRpc', this, ['-3712903026592331065', 941622746, '//2k026imuihnrho207b8ideld4uc88ppu-a-sites-opensocial.googleusercontent.com/gadgets/ifr?url\x3dhttps://storage.googleapis.com/goinggas.com/public/hosting/sites/xliberation/xml/sitesense.xml\x26container\x3denterprise\x26view\x3ddefault\x26lang\x3den\x26country\x3dALL\x26sanitize\x3d0\x26v\x3d9ab5f6e4d805d588\x26libs\x3dcore:dynamic-height\x26mid\x3d77\x26parent\x3dhttp://www.mcpher.com/Home/excelquirks/colorfiesta/heatmap/lib/rampfromanother#up_client\x3dca-pub-0073976545556837\x26up_slot\x3d5457792947\x26st\x3de%3DAIHE3cBfGusAy7OQh5kvuLIfKpts0p7E%252BHJtB%252B4XXbbu3aQi9Afne6mAcjhBjFvJnLI78tSpBwBBKI0JcKd6a%252F8uqI6Hx5eyMID7ZLIwBaacK9H2cLo7jMZiFg3o4E8amW3eab5L6OYg%26c%3Denterprise\x26rpctoken\x3d-3712903026592331065'])JOT_postEvent('registerForRpc', this, ['-3712903026592331065', 679376440, '//2k026imuihnrho207b8ideld4uc88ppu-a-sites-opensocial.googleusercontent.com/gadgets/ifr?url\x3dhttps://storage.googleapis.com/goinggas.com/public/hosting/sites/xliberation/xml/sitesense.xml\x26container\x3denterprise\x26view\x3ddefault\x26lang\x3den\x26country\x3dALL\x26sanitize\x3d0\x26v\x3d9ab5f6e4d805d588\x26libs\x3dcore:dynamic-height\x26mid\x3d77\x26parent\x3dhttp://www.mcpher.com/Home/excelquirks/colorfiesta/heatmap/lib/rampfromanother#up_client\x3dca-pub-0073976545556837\x26up_slot\x3d5457792947\x26st\x3de%3DAIHE3cANQpS3Fo1vptV96kBTkD7veuSVCxaKN8nfaqeZ11w7BTWLtlUQzNdPFcHaiKq6HgEVDJwLkgzjzz7eH1J9kCT8UGCj%252FzV9zKraqzi9Np3a5dXBkTbVVHtrfc%252BZW1qZIUUaIaR8%26c%3Denterprise\x26rpctoken\x3d-3712903026592331065'])`