color("red")
color("#ff0099")
color(r: 200, g: 60, b: 20, a: 200)
color(h:150, s:30, l:60)
Generates a color value either from a CSS color description or via the components in the red-green-blue or HSL color space.
| Color name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
css |
String | The CSS color description. | no | - |
r |
Number | The red value (0..255) | no | 0 |
g |
Number | The green value (0..255) | no | 0 |
b |
Number | The blue value (0..255) | no | 0 |
a |
Number | The alpha value (0..255) | no | 255 |
h |
Number | The hue angle (0..360) | no | 0 |
s |
Number | The saturation (0..100) | no | 100 |
l |
Number | The luminance (0..100) | no | 50 |
from |
Color | Sample color | no | - |
Type: Color
The color that corresponds to the specified values. The following rules apply in the specified order:
css is specified, the description is translated into a color. If a is also specified, then this alpha value is applied to the color. All other values are ignored.r, g, or b is specified, a color is created in the RGB color space. If a is also specified, then this alpha value is applied to the color. All other values are ignored.h, s, and l. Missing values are taken from the sample color from if this is specified. Without a sample color, missing values are filled with the specified default values.
count(0, 360, 20).map(h -> color(h: $h, s:80))
Output: List with the colors of the rainbow