fromString MethodStatic
Create a ColorDef from a string representation. The following representations are supported: "rgb(255,0,0)" "rgba(255,0,0,.2)" "rgb(100%,0%,0%)" "hsl(120,50%,50%)" "#rrbbgg" "blanchedAlmond" (see possible values from ColorByName). Case-insensitive.
If val is not a valid color string, this function returns black.
fromString(val: string): ColorDef
@see isValidColor to determine if val is a valid color string.
| Parameter | Type | Description |
|---|---|---|
| val | string |
Returns - ColorDef
Defined in
- core/common/src/ColorDef.ts Line 138
Last Updated: 28 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.