# Gradient

In this tutorial, I will explain how you can use Gradient to color a set of panels based on their height.

In the first step, we can make a rectangular surface in Rhino and deform it by “softeditsrf”.

Next, we import the surface into Grasshopper 3d (Params>geometry>surface). We can divide the surface into panels by using “isotrim” (Surface>util). Isotrim can be combined by “Divide Domain2″(Maths>Domain) to divide the surface into subsurfaces.

To colour the panels based on their height we need their “Z coordinate”. We can have their centroids (Surface> analysis) and then extract the z coordinate by “deconstruct point” (vector>point).

“Gradient” (Params>input) has three inputs. First is the “Lower limit” which is the starting colour of the gradient and obviously the “upper limit” is the last colour. “Parameter” is the colour we want. We need the minimum height for the lower limit and the maximum for the upper limit. We can use the “Bounds” (Maths>domain) to extract the domain of the z coordinates. By using the “deconstruct domain” (Maths>domain) we can have the start and end numbers of the domain.

By giving the “z coordinate” of the points to the gradient’s “parameter” we can have the right colour.

At the end, we can connect the Gradient to a “custom preview ” (display > preview) and give the panels (isotrim output) the “geometry”.

If we give the “y component” of the points we can see that the panels will be colourd based on their y coordinates.