Parametric Gradient


This component allows for the parametric definition and evaluation of a color gradient. Using a list of colors as an input a gradient will be created from the sequential pattern. Optional corresponding percent values can be used to specify the unitized location of each color along the gradient sequence. A unitized value can then be sampled from the gradient returning the color at the specified location. Additionally, the gradient can be toggled between a linear or a smoothed (cosine based) gradation between provided colors.


Parametric Gradient

VInDoubleItemThe unitized (0-1) percent value from which the gradient will be sampled
CInColorListA sequential list of colors defining the gradient pattern
TInDoubleListAn optional list of unitized percent values which represent the placement on the gradient of each matching color. The number of values must match the number of colors, else the colors will be evenly distributed
L InBooleanItemIf true the gradient will be interpolated using a linear gradation, else colors will be interpolated using a cosine equation
AOutColorItemThe color at the given sample value


Minimum Requirements

PlatformRhino 5, Grasshopper
VersionGrasshopper 0.9.0075
TypeC# Component

1 thought on “Parametric Gradient”

  1. As written this only interpolates RGB. I wanted it to do alpha as well so I edited the source like this:
    If L Then
    A = color.FromArgb(ReMapClr(fClr.A, cClr.A, j), ReMapClr(fClr.R, cClr.R, j), ReMapClr(fClr.G, cClr.G, j), ReMapClr(fClr.B, cClr.B, j))
    A = color.FromArgb(ReMapClrA(fClr.A, cClr.A, j), ReMapClrA(fClr.R, cClr.R, j), ReMapClrA(fClr.G, cClr.G, j), ReMapClrA(fClr.B, cClr.B, j))
    End If

    If you too wish alpha interpolation, go forth and do likewise.

Comments are closed.