Skip to main content

Function: getVec4ByColorString()

getVec4ByColorString(colorString): Vector4

Defined in: src/utils/utils.ts:117

Parses a color string (hexadecimal with optional alpha) into a THREE.Vector4. Supports:

  • #rgb (shorthand, alpha defaults to 1)
  • #rrggbb (alpha defaults to 1)
  • #rgba (shorthand)
  • #rrggbbaa

Parameters

colorString

string

The color string to parse (e.g., '#66ccff', '#6cf5', '#66ccff55', '#6cf').

Returns

Vector4

The parsed color as a THREE.Vector4 (r, g, b, a), with components in the 0-1 range.

Throws

If the input is not a string or if the hex string is invalid.