import * as lodash from 'lodash'; import Color from 'color'; type ColorRgbInfo = { /** From 0 - 255 */ r: number; /** From 0 - 255 */ g: number; /** From 0 - 255 */ b: number; /** From 0 - 1 */ alpha?: number; }; type ColorHslInfo = { /** From 0 - 255 */ h: number; /** From 0 - 255 */ s: number; /** From 0 - 255 */ l: number; /** From 0 - 1 */ alpha?: number; }; type ColorFormat = 'hex' | 'hsl' | 'rgb'; declare function analyzeColorBase(color: string): { original: string; format: ColorFormat | null; rgbInfo: Record; rgbString: string; hslInfo: Record; hslString: string; hex: string; isTransparent: boolean; luminosity: number; isDark: boolean; isLight: boolean; color: Color; }; declare const analyzeColor: typeof analyzeColorBase & lodash.MemoizedFunction; /** * Is a valid css color */ declare function isColor(color: string): boolean; declare function assertColor(color: string): asserts color is string; /** * @deprecated - use `analyzeColor` * @see analyzeColor */ declare function getColorRgbInfo(color: string): ColorRgbInfo; /** * @deprecated - use `analyzeColor` * @see analyzeColor */ declare function getColorHslInfo(color: string): ColorHslInfo; /** * Has Opacity * Returns true if a color has opacity * @deprecated - use `analyzeColor` * @see analyzeColor */ declare function hasOpacity(color: string): boolean; /** * @deprecated - use `analyzeColor` * @see analyzeColor */ declare function getColorLuminosity(color: string): number; /** * Color Contrast * @deprecated - use `analyzeColor` * @see analyzeColor * @param color - color value to check. supports any number of formats (hex, rgb, hsl, etc) * @returns {boolean} - true if the color is "dark" (ie. you should use a lighter color on top) and false if the color is light. */ declare function isDarkColor(color: string): boolean; /** * Color Contrast * @deprecated - use `analyzeColor` * @see analyzeColor * @param color - color value to check. supports any number of formats (hex, rgb, hsl, etc) * @returns {boolean} - true if the color is "light" (ie. you should use a darker color on top) and false if the color is dark. */ declare function isLightColor(color: string): boolean; /** * @deprecated - use `analyzeColor` * @see analyzeColor */ declare function convertColor({ color, format, }: { color: string; format: ColorFormat; }): string; /** * @deprecated - use `analyzeColor` * @see analyzeColor */ declare function convertTransparentColorToHex(color: string): string; /** * Contrast checking. * * IMPORTANT: CANNOT USE ALPHA CHANNELS IN CONTRAST CALCULATIONS. * This can only compare 2 SOLID colors. */ declare function isColorContrastEnough({ foregroundColor, bgColor, }: { foregroundColor: string; bgColor: string; }): boolean; export { type ColorFormat, type ColorHslInfo, type ColorRgbInfo, analyzeColor, assertColor, convertColor, convertTransparentColorToHex, getColorHslInfo, getColorLuminosity, getColorRgbInfo, hasOpacity, isColor, isColorContrastEnough, isDarkColor, isLightColor };