Home > @infiniteobjects/data-types > Color > fromString
Creates a new color from the given string
Signature:
static fromString(color: string): Color;
Parameter | Type | Description |
---|---|---|
color | string |
Returns:
This technically let us create colors from CSS color representations
const color = Color.fromString("red")
color.toHexString(); // "#ff0000"