Gradients

A gradient shows transitions between two or more colors. You can fill a shape or the outline of a shape with a gradient.

These gradients are available in Kanzi Shapes:

Gradient color stops

Color stops define the colors in gradients. A color stop is a combination of a color and stop length Use the CSS color stop syntax to set color stops. See https://www.w3.org/TR/css-images-4/#color-stop-syntax.

This table lists examples of gradient color stops.

Color stop element

Example Gradient Stops

Result

Color

To define colors, use either:

rgba(255,0,0,1), rgba(0,128,0,1), rgba(0,0,255,1)
rgb(255,0,0), rgb(0,128,0), rgb(0,0,255)
red, green, blue
../../_images/gradient-color-stops-rgb.png

Color stop length

To define color stop lengths, use either:

  • Decimal values in the range 0…1

  • Percentages

red 0.2, green 0.8, blue 1
red 20%, green 80%, blue 100%
../../_images/gradient-color-stops-lengths.png

Multi-position color stop

Use multi-position color stops to create uniform colors areas.

red 33%, green 33% 67%, blue 67%
../../_images/gradient-color-stops-stripe.png

Midpoint between color stops

Use a color interpolation hint between two color stops to define the location of the color that is a halfway blend between the two colors.

red, 15%, green, 85%, blue
../../_images/gradient-color-stops-midpoints.png