gradient(c1, c2, [name])

Creates a new gradient and adds it to the document, or gets a gradient by name from the document. If two colors are given as the first two parameters, a gradient is created that blends between these two colors. If an array of colors is used as the first parameter, a gradient with the contained colors will be created. The colors will be distributed evenly. If additionally to this array a second array of gradient stop positions is given, the colors will be positioned at the given gradient stops. Possible gradient stop positions range from 0 to 100. All parameter options allow for an additional name parameter at the end to name the new gradient. If a string is used as the only parameter, the gradient with that name will be returned, if it exists in the document.

Type: function

Parameter(s):

  • c1 {Color | Array | String}:

    First color of the gradient. Alternatively: Array of colors/gradients or name of gradient to get.

  • c2 {Color | Array | String}:

    Second color of the gradient. Alternatively: Array of gradient stop positions (if first parameter is an array of colors).

  • name {String} Optional:

    Optional name of the gradient.

Returns:

  • {Gradient}:

    Found or new gradient