requireColor()function
requireColor(value: PossibleColor, caller: AnyCaller = requireColor): Color
| Param | Type | |
|---|---|---|
value | PossibleColor | The possible color to convert. required |
caller | AnyCaller | Function to attribute a thrown error to (defaults to requireColor itself). Defaults to requireColor |
| Return | |
|---|---|
Color | Represents an RGBA color with red, green, blue, and alpha channels (each 0–255). |
| Throws | |
|---|---|
RequiredError | If value cannot be converted to a Color. |
Convert a possible color to a Color instance, or throw RequiredError if it can't be converted.
Examples
requireColor("#F00") // Color(255, 0, 0)