API Reference > imodeljs-common > Symbology > ColorDef > fromString 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 ColorDef.black. fromString(val: string): ColorDef see ColorDef.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 129 Last Updated: 12 June, 2024