stack

Home > @infiniteobjects/data-types > Color > fromString

Color.fromString() method

Creates a new color from the given string

Signature:

static fromString(color: string): Color;

Parameters

Parameter Type Description
color string  

Returns:

Color

Remarks

This technically let us create colors from CSS color representations

Example

const color = Color.fromString("red")
color.toHexString(); // "#ff0000"