@tolokoban/ui
Version:
React components with theme
44 lines • 1.42 kB
TypeScript
export default class Color {
private static _ctx;
private static get ctx();
static makeGradient(size: number, ...from: Array<string | Color>): Color[];
/**
* Get a value from a colorramp made of `from` colors.
*
* @param from Colors
* @param value From 0.0 to 1.0
*/
static mix(value: number, ...from: Array<string | Color>): Color;
static isLight(colorSource: string | Color): boolean;
static isDark(colorSource: string | Color): boolean;
/**
* @param backgroundColor Reference color.
* @param foregroundColors Candidates colors.
* @returns Find among `foregroundColors` the one that has the most contrast with `backgroundColor`.
*/
static bestContrast(backgroundColor: string | Color, ...foregroundColors: (string | Color)[]): Color;
R: number;
G: number;
B: number;
H: number;
S: number;
L: number;
A: number;
constructor(colorSource: string | Color);
from(colorSource: string | Color): this;
toString(): string;
get luminance(): number;
get perceivedLightness(): number;
/**
* Remove gamma from sRGB component.
*/
sRgbToLinear(value: number): number;
isLight(): boolean;
isDark(): boolean;
rgb2hsl(): void;
/**
* @see https://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB
*/
hsl2rgb(): this;
}
//# sourceMappingURL=color.d.ts.map