import { ColorRGBA64 } from "@microsoft/fast-colors"; import { DesignSystemResolver } from "../../design-system"; /** * Describes the format of a single color in a palette */ export declare type Swatch = string; /** * Interface describing a family of swatches. */ export interface SwatchFamily { /** * The swatch to apply to the rest state */ rest: Swatch; /** * The swatch to apply to the hover state */ hover: Swatch; /** * The swatch to apply to the active state */ active: Swatch; /** * The swatch to apply to the focus state */ focus: Swatch; } /** * Interface describing a family of swatches applied as fills */ export interface FillSwatchFamily extends SwatchFamily { /** * The swatch to apply to the selected state */ selected: Swatch; } /** * A DesignSystemResolver that resolves a Swatch */ export declare type SwatchResolver = DesignSystemResolver; /** * A function that accepts a design system and resolves a SwatchFamily or FillSwatchFamily */ export declare type SwatchFamilyResolver = DesignSystemResolver; /** * A function type that resolves a Swatch from a SwatchResolver * and applies it to the backgroundColor property of the design system * of the returned DesignSystemResolver */ export declare type DesignSystemResolverFromSwatchResolver = (resolver: SwatchResolver) => DesignSystemResolver; /** * The states that a swatch can have */ export declare enum SwatchFamilyType { rest = "rest", hover = "hover", active = "active", focus = "focus", selected = "selected" } export declare type ColorRecipe = DesignSystemResolver & DesignSystemResolverFromSwatchResolver; export declare function colorRecipeFactory(recipe: DesignSystemResolver): ColorRecipe; /** * A function to apply a named style or recipe. A ColorRecipe has several behaviors: * 1. When provided a callback function, the color Recipe returns a function that expects a design-system. * When called, the returned function will call the callback function with the input design-system and apply * the result of that function as background to the recipe. This is useful for applying text recipes to colors * other than the design system backgroundColor * 2. When provided a design system, the recipe will use that design-system to generate the color */ export declare type SwatchRecipe = ColorRecipe; /** * Helper function to transform a SwatchFamilyResolver into simple ColorRecipe for simple use * use in stylesheets. */ export declare function swatchFamilyToSwatchRecipeFactory(type: keyof T, callback: SwatchFamilyResolver): SwatchRecipe; /** * Converts a color string into a ColorRGBA64 instance. * Supports #RRGGBB and rgb(r, g, b) formats */ export declare const parseColorString: (color: string) => ColorRGBA64; /** * Determines if a string value represents a color * Supports #RRGGBB and rgb(r, g, b) formats */ export declare function isValidColor(color: string): boolean; /** * Determines if a color string matches another color. * Supports #RRGGBB and rgb(r, g, b) formats */ export declare function colorMatches(a: string, b: string): boolean; /** * Returns the contrast value between two color strings. * Supports #RRGGBB and rgb(r, g, b) formats. */ export declare const contrast: (a: string, b: string) => number; /** * Returns the relative luminance of a color. If the value is not a color, -1 will be returned * Supports #RRGGBB and rgb(r, g, b) formats */ export declare function luminance(color: string): number; export declare function designSystemResolverMax(...args: Array>): DesignSystemResolver; export declare const clamp: (value: number, min: number, max: number) => number;