Skip to main content

Hex

Functions

hexToColor

hexToColor(hexString, alpha?): Readonly<Color>

Converts a hex string like "#33aa33" to a KColor object.

Parameters

NameTypeDefault valueDescription
hexStringstringundefinedA hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
alphanumber1Optional. Range is from 0 to 1. Default is 1. (The same as the Color constructor.)

Returns

Readonly<Color>

Defined in

packages/isaacscript-common/src/functions/hex.ts:11


hexToKColor

hexToKColor(hexString, alpha?): Readonly<KColor>

Converts a hex string like "#33aa33" to a Color object.

Parameters

NameTypeDefault valueDescription
hexStringstringundefinedA hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
alphanumber1Range is from 0 to 1. Default is 1.

Returns

Readonly<KColor>

Defined in

packages/isaacscript-common/src/functions/hex.ts:25