rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
49 lines • 1.61 kB
TypeScript
/**
* @public
* Utility for packing and unpacking RGBA into int32 with one byte per channel.
*/
export declare class RgbaColorPacker {
/**
* @param color - Bit packed color.
* @returns a value between 0 - 255 representing the red component.
*/
static unpackR(color: number): number;
/**
* @param color - Bit packed color.
* @returns a value between 0 - 255 representing the green component.
*/
static unpackG(color: number): number;
/**
* @param color - Bit packed color.
* @returns a value between 0 - 255 representing the blue component.
*/
static unpackB(color: number): number;
/**
* @param color - Bit packed color.
* @returns a value between 0 - 255 representing the alpha component.
*/
static unpackA(color: number): number;
/**
*
* @param r - Red 0 - 255.
* @param g - Green 0 - 255.
* @param b - Blue 0 - 255.
* @param a - Alpha 0 - 255.
*/
static packColor(r: number, g: number, b: number, a: number): number;
/**
* Given a packed color, produce a dom color string like `rgba(255, 255, 255, 1)`.
*/
static makeDomColorString(color: number): string;
/**
* Given a packed color, produce a dom color string like `#FF0000`.
*
* @remarks
* Made up of only 6 components, the alpha channel will be masked out.
*/
static getHexColorString(value: number): string;
static generateRandomPackedRGBA(): number;
private static colorStringTmp;
private static hexColorTmp;
}
//# sourceMappingURL=rgba-color-packer.d.ts.map