UNPKG

pigmentjs

Version:

A zero-dependency colour organisation, creation and manipulation library built for web developers.

38 lines (37 loc) 1.25 kB
import { RGB, HSL, RGBString } from "./types"; export declare class Pigment { readonly hex: string; readonly rgb: [number, number, number]; readonly irgb: RGB; readonly rgbString: RGBString; readonly hsl: [number, number, number]; readonly ihsl: HSL; readonly hue: number; readonly saturation: number; readonly lightness: number; readonly hslString: string; readonly relativeLuminance: number; readonly textColourHex: string; constructor(hex?: string); /** * Convert to HSL, rotate hue 180 degrees, convert * back to RGB and instantiate pigmentjs with hex */ complementary(): Pigment; /** * Convert to HSL, rotate hue 120 degrees (twice), convert * back to RGB and instantiate pigmentjs with hex */ triad(): [Pigment, Pigment, Pigment]; monochrome(size: number): Pigment[]; shades(size: number): Pigment[]; tints(size: number): Pigment[]; /** * Return either white or black depending on the relative luminance * of the primary colour. Can be used to ensure text is legible * * @returns {String} either '#FFFFFF' or '#000000' */ _textColourHex(relativeLuminance: number): string; } export default Pigment;