@tsports/go-colorful
Version:
A TypeScript port of the go-colorful package for working with colors
40 lines • 1.21 kB
TypeScript
/**
* HexColor type for database and JSON serialization
* TypeScript port of Go colorful.HexColor type with identical API
*/
import { Color } from './color';
export declare class ErrUnsupportedType extends Error {
constructor(got: unknown, want: string);
}
export declare class HexColor {
r: number;
g: number;
b: number;
constructor(r?: number, g?: number, b?: number);
static fromColor(color: Color): HexColor;
toColor(): Color;
getColor(): Color;
setColor(color: Color): void;
static fromHex(hexCode: string): HexColor;
hex(): string;
toString(): string;
scan(value: unknown): void;
static scan(value: unknown): HexColor;
value(): string;
toJSON(): string;
fromJSON(data: string): void;
static fromJSON(data: string): HexColor;
decode(hexCode: string): void;
static decode(hexCode: string): HexColor;
toYAML(): string;
fromYAML(hexCode: string): void;
static fromYAML(hexCode: string): HexColor;
get R(): number;
set R(value: number);
get G(): number;
set G(value: number);
get B(): number;
set B(value: number);
equals(other: HexColor): boolean;
}
//# sourceMappingURL=hexcolor.d.ts.map