Skip to content

LinearGradient

Fills content with a linear gradient, as SwiftUI's LinearGradient.

<LinearGradient ... />

Overview

With colors the gradient runs through those semantic colors, evenly spaced from startPoint to endPoint, and follows light and dark appearance. Without colors it is a vertical black fade for laying text over artwork, shaped by the alpha props.

Topics

Properties

Name Type Required Description
colors table optional Two or more color names, in order.
startPoint string optional Unit point the first color sits at: top, bottom, leading, trailing, center or a corner such as topLeading. Default top.
endPoint string optional Unit point the last color sits at. Default bottom.
bottomAlpha number optional Fade opacity at the bottom edge.
middleAlpha number optional Fade opacity at the middle stop.
middleLocation number optional Position of the fade's middle stop, from 0 to 1.
topAlpha number optional Fade opacity at the top edge.

Example

<LinearGradient colors="systemIndigo,systemPink" startPoint="topLeading" endPoint="bottomTrailing" />

Platform notes

  • AppKit and UIKit.

Source: lua/embedded/AppKit.lua:1364 (AppKit.LinearGradient)