Skip to main content

Color

Type Aliases

SerializedColor

Ƭ SerializedColor: LuaMap<string, unknown> & { __serializedColorBrand: symbol ; __kind: CopyableIsaacAPIClassType.COLOR }

Defined in

packages/isaacscript-common/src/functions/color.ts:14

Functions

colorEquals

colorEquals(color1, color2): boolean

Parameters

NameType
color1Color
color2Color

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/color.ts:22


copyColor

copyColor(color): Color

Helper function to copy a Color Isaac API class.

Parameters

NameType
colorColor

Returns

Color

Defined in

packages/isaacscript-common/src/functions/color.ts:27


deserializeColor

deserializeColor(color): Color

Helper function to convert a SerializedColor object to a normal Color object. (This is used by the save data manager when reading data from the "save#.dat" file.)

Parameters

NameType
colorSerializedColor

Returns

Color

Defined in

packages/isaacscript-common/src/functions/color.ts:49


getRandomColor

getRandomColor(seedOrRNG, alpha?): Readonly<Color>

Helper function to get a random Color object.

If you want to generate an unseeded object, you must explicitly pass undefined to the seedOrRNG parameter.

Parameters

NameTypeDefault valueDescription
seedOrRNGundefined | RNG | SeedundefinedThe Seed or RNG object to use. If an RNG object is provided, the RNG.Next method will be called. If undefined is provided, it will default to a random seed.
alphanumber1Optional. The alpha value to use. Default is 1.

Returns

Readonly<Color>

Defined in

packages/isaacscript-common/src/functions/color.ts:89


isColor

isColor(object): object is Color

Helper function to check if something is an instantiated Color object.

Parameters

NameType
objectunknown

Returns

object is Color

Defined in

packages/isaacscript-common/src/functions/color.ts:103


isSerializedColor

isSerializedColor(object): object is SerializedColor

Used to determine is the given table is a serialized Color object created by the deepCopy function.

Parameters

NameType
objectunknown

Returns

object is SerializedColor

Defined in

packages/isaacscript-common/src/functions/color.ts:111


serializeColor

serializeColor(color): SerializedColor

Helper function to convert a Color object to a SerializedColor object. (This is used by the save data manager when writing data from the "save#.dat" file.)

Parameters

NameType
colorColor

Returns

SerializedColor

Defined in

packages/isaacscript-common/src/functions/color.ts:123