Skip to main content

KColor

Type Aliases

SerializedKColor

Ƭ SerializedKColor: LuaMap<string, unknown> & { __serializedKColorBrand: symbol ; __kind: CopyableIsaacAPIClassType.K_COLOR }

Defined in

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

Functions

copyKColor

copyKColor(kColor): KColor

Helper function to copy a KColor Isaac API class.

Parameters

NameType
kColorKColor

Returns

KColor

Defined in

packages/isaacscript-common/src/functions/kColor.ts:23


deserializeKColor

deserializeKColor(kColor): KColor

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

Parameters

NameType
kColorSerializedKColor

Returns

KColor

Defined in

packages/isaacscript-common/src/functions/kColor.ts:37


getRandomKColor

getRandomKColor(seedOrRNG, alpha?): Readonly<KColor>

Helper function to get a random KColor object (for use in fonts).

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<KColor>

Defined in

packages/isaacscript-common/src/functions/kColor.ts:77


isKColor

isKColor(object): object is KColor

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

Parameters

NameType
objectunknown

Returns

object is KColor

Defined in

packages/isaacscript-common/src/functions/kColor.ts:91


isSerializedKColor

isSerializedKColor(object): object is SerializedKColor

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

Parameters

NameType
objectunknown

Returns

object is SerializedKColor

Defined in

packages/isaacscript-common/src/functions/kColor.ts:99


kColorEquals

kColorEquals(kColor1, kColor2): boolean

Parameters

NameType
kColor1KColor
kColor2KColor

Returns

boolean

Defined in

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


serializeKColor

serializeKColor(kColor): SerializedKColor

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

Parameters

NameType
kColorKColor

Returns

SerializedKColor

Defined in

packages/isaacscript-common/src/functions/kColor.ts:119