Skip to content

Gradient Generator and Utilities

Last week I was inspired by this interesting discussion about Grasshopper gradient and a method to implement its gradient library. Here you can read about this.

The author of that discussion (Timo Harboe Nielsen) has implemented a clever method to export the MatLab gradient library and then lead them inside the Grasshopper environment as a grasshopper_gradients.xml file —>here the file.

At this point, I thought: What does it is possible to implement for the generation of Grasshopper gradient component helpful for all kinds of users?

I know that a lot of you have struggled in creating gradient components with many grip points or, for instance, in reducing the number of these points.


So I developed these components below using Grasshopper API:




It is a gradient generator that allows the user to setup custom colours (at left/right of the grips), custom grip points position, linear interpolation to make the colours transition smoother, lock option prevents Gradient component from editing, sliding the single RGB value of the custom gradient and finally, by baking action you can add your own gradient directly on the canvas.

GradientGen component



It allows the user to deconstruct partially the gradient component (only useful info for this scope) and simplify the number of the grip points. Main output: grips count, source RGB value (from gradient that you want to simplify) and target RGB value (after simplification – you set up the number of grip points). This component easily reduces the number of grips that come from the Matlab gradient library (~33) in whatever number you prefer.



At this second point I thought: Surfing the web I found valid free gradient generators, why not use them to generate captivating colour gradients?

Path A

From this site:

You can set up a custom colour and a custom number of grip points directly from your browser. The second step consists in converting HEX values to RGB so you can pass these values in GradientGen Component that easily generates your gradient as shown on the web – WYSIWYG (What You See Is What You Get).


Path B

From this site:

You can set up custom colours and the number of grip points easily and in a very similar way you do it with a Grasshopper component (I mean sliding the grip points, for instance). The second step, here, is a simple Copy&Paste action of the text automatically generated from the ColorZilla web application – pay attention to set “rgb” value at the bottom of the text-box window. Paste this text into CZGradDecod Component and, finally, pass the RGB values and Grip positions in GradientGen Component that easily generates your gradient as shown on the web – WYSIWYG (What You See Is What You Get).


Dulcis in fundo!
Just for Environmental Designers and Ladybug/Honeybee users 😉

At this point, and with my own tools, I thought: I want to generate the Ladybug Gradient colours library!

I decoded the Ladybug/Honeybee (LB/HB) code and extracted the RGB values so throughout GradientGen Component I have generated all 24 Gradients and finally added them to the Grasshopper gradient library. Now you can add LB/HB gradient by simply loading the grasshopper_gradients.xml into this folder: C:\Users\YourNAME\AppData\Roaming\Grasshopper


Video demo

If you watch it on YouTube can jump to specific frames of your interest, simply give a look at the video description.


Please have a look here I have updated these components in a unique toolbar called “Ambrosinus-toolkit”

Download these components from HERE 


Interested in my works? see *About Me* section and contact me by email and/or by social