RgbaColor
Interface representing a color in RGBA format.Red component (0-255)
Green component (0-255)
Blue component (0-255)
Alpha component (0-1)
parseColor
Parses a color string into an RGBA object.Color string in hex, RGB/RGBA, or HSL/HSLA format
Parsed color as an RGBA object
Supported formats
- Hex:
#RGB,#RGBA,#RRGGBB,#RRGGBBAA - RGB/RGBA:
rgb(r, g, b),rgba(r, g, b, a) - HSL/HSLA:
hsl(h, s%, l%),hsla(h, s%, l%, a)
Example
Errors
ThrowsHeliosError with code INVALID_COLOR_FORMAT if the color string is not in a supported format.
interpolateColors
Interpolates between colors based on an input value.The value to interpolate
Array of input values (must be strictly monotonically increasing). Minimum 2 elements.
Array of output color strings (must match length of inputRange). Colors can be in any supported format.
Configuration for extrapolation and easing
Interpolated color as an RGBA string
Options
Behavior when input is less than the first inputRange value. Default:
'extend'Behavior when input is greater than the last inputRange value. Default:
'extend'Easing function to apply to the interpolation ratio
Example
Errors
ThrowsHeliosError with:
INVALID_INPUT_RANGEif inputRange and outputRange lengths don’t match or have fewer than 2 elementsUNSORTED_INPUT_RANGEif inputRange is not strictly monotonically increasingINVALID_COLOR_FORMATif any color in outputRange cannot be parsed