Contents

setColors(_:locations:)

Sets the macOS colors and corresponding unit distance values to create gradients.

Declaration

func setColors(_ colors: [NSColor], locations: [CGFloat])

Parameters

  • colors:

    An array of colors making up the transition points of the gradient.

  • locations:

    An array of unit distance values that correspond to the provided colors.

Discussion

The unit distance value of 0 represents the start of the polyline, and 1 represents the end of the polyline. A gradient may have any number of steps along the length of the polyline.

To determine a location along the polyline, use location(atPointIndex:), or retrieve a set of locations using locations.

See Also

Accessing the gradient colors