UNPKG

1 kBTypeScriptView Raw
1export type ColorFormat = 'rgb' | 'rgba' | 'hsl' | 'hsla';
2export interface ColorObject {
3 type: ColorFormat;
4 values: [number, number, number] | [number, number, number, number];
5}
6
7export function hexToRgb(hex: string): string;
8export function rgbToHex(color: string): string;
9export function hslToRgb(color: string): string;
10export function decomposeColor(color: string): ColorObject;
11export function recomposeColor(color: ColorObject): string;
12export function getContrastRatio(foreground: string, background: string): number;
13export function getLuminance(color: string): number;
14export function emphasize(color: string, coefficient?: number): string;
15/**
16 * @deprecated
17 * Use `import { alpha } from '@material-ui/core/styles'` instead.
18 */
19export function fade(color: string, value: number): string;
20export function alpha(color: string, value: number): string;
21export function darken(color: string, coefficient: number): string;
22export function lighten(color: string, coefficient: number): string;