UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

38 lines 1.9 kB
import type { CopyableIsaacAPIClassType } from "isaac-typescript-definitions"; export type SerializedColor = LuaMap<string, unknown> & { readonly __serializedColorBrand: symbol; readonly __kind: CopyableIsaacAPIClassType.COLOR; }; export declare function colorEquals(color1: Color, color2: Color): boolean; /** Helper function to copy a `Color` Isaac API class. */ export declare function copyColor(color: 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.) */ export declare function deserializeColor(color: SerializedColor): 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. * * @param seedOrRNG The `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. * @param alpha Optional. The alpha value to use. Default is 1. */ export declare function getRandomColor(seedOrRNG: Seed | RNG | undefined, alpha?: number): Readonly<Color>; /** Helper function to check if something is an instantiated `Color` object. */ export declare function isColor(object: unknown): object is Color; /** * Used to determine is the given table is a serialized `Color` object created by the `deepCopy` * function. */ export declare function isSerializedColor(object: unknown): object is 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.) */ export declare function serializeColor(color: Color): SerializedColor; //# sourceMappingURL=color.d.ts.map