Grasshopper Gradient Generator and Utilities
How do implement the Grasshopper gradient component creation and improve the ability to produce a captivating gradient palette?
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:
GradientGen
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.
GradientDecod
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 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: https://colordesigner.io/gradient-generator
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: https://www.colorzilla.com/gradient-editor/
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 simply load 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.
Use for your projects the GradientGen components from Ambrosinus-toolkit downloading them from this link: Ambrosinus GitHub page