UNPKG

@compositive/foundation

Version:

Compositive framework foundation package.

33 lines 1.27 kB
import type { SerializableTo } from "@compositive/commons-serialization"; import type { Color as PrimitiveColor } from "@compositive/primitives"; import chroma from "chroma-js"; import type { ConvertibleToStyle } from "../styling"; import { StaticStyle } from "../styling"; export declare class Color implements SerializableTo<string>, ConvertibleToStyle<never> { #private; static fromJson(json: string): Promise<Color>; static fromBinary([r, g, b]: Uint8Array): Color; static isValid(color: ColorLikeValue): boolean; constructor(colorValue: ColorLikeValue); asForeground(): StaticStyle; asBackground(): StaticStyle; toStaticStyle(): StaticStyle; get hex(): HexColorString; get r(): number; get g(): number; get b(): number; get h(): number; get s(): number; get l(): number; get a(): number; get rgb(): [number, number, number]; get hsl(): [number, number, number]; get luminance(): number; alpha(alpha: number): Color; toString(): string; toBinary(): Uint8Array; toJson(): Promise<string>; } export declare type HexColorString = `#${string}`; export declare type ColorLikeValue = number | HexColorString | Color | chroma.Color | PrimitiveColor; //# sourceMappingURL=Color.d.ts.map