import { DesignSystem, DesignSystemResolver } from "../../design-system"; import { Swatch, SwatchResolver } from "./common"; /** * The named palettes of the MSFT design system * @deprecated - use neutralPalette and accentPalette functions instead */ export declare enum PaletteType { neutral = "neutral", accent = "accent" } /** * The structure of a color palette */ export declare type Palette = Swatch[]; /** * Retrieves a palette by name. This function returns a function that accepts * a design system, returning a palette a palette or null * @deprecated - use neutralPalette and accentPalette functions instead */ export declare function palette(paletteType: PaletteType): DesignSystemResolver; /** * A function to find the index of a swatch in a specified palette. If the color is found, * otherwise it will return -1 */ export declare function findSwatchIndex(paletteResolver: Palette | DesignSystemResolver, swatch: Swatch): DesignSystemResolver; /** * Returns the closest swatch in a palette to an input swatch. * If the input swatch cannot be converted to a color, 0 will be returned */ export declare function findClosestSwatchIndex(paletteResolver: Palette | DesignSystemResolver, swatch: Swatch | DesignSystemResolver): DesignSystemResolver; /** * Determines if the design-system should be considered in "dark mode". * We're in dark mode if we have more contrast between #000000 and our background * color than #FFFFFF and our background color. That threshold can be expressed as a relative luminance * using the contrast formula as (1 + 0.5) / (bg + 0.05) === (bg + 0.05) / (0 + 0.05), * which reduces to the following, where bg is the relative luminance of the background color */ export declare function isDarkMode(designSystem: DesignSystem): boolean; /** * Determines if the design-system should be considered in "light mode". */ export declare function isLightMode(designSystem: DesignSystem): boolean; /** * Safely retrieves an index of a palette. The index is clamped to valid * array indexes so that a swatch is always returned */ export declare function getSwatch(index: number, colorPalette: Palette): Swatch; export declare function getSwatch(index: DesignSystemResolver, colorPalette: DesignSystemResolver): DesignSystemResolver; export declare function swatchByMode(paletteResolver: DesignSystemResolver): (a: number | DesignSystemResolver, b: number | DesignSystemResolver) => DesignSystemResolver; /** * Retrieves a swatch from an input palette, where the swatch's contrast against the reference color * passes an input condition. The direction to search in the palette is determined by an input condition. * Where to begin the search in the palette will be determined another input function that should return the starting index. * example: swatchByContrast( * "#FFF" // compare swatches against "#FFF" * )( * neutralPalette // use the neutral palette from the DesignSystem - since this is a function, it will be evaluated with the DesignSystem * )( * () => 0 // begin searching for a swatch at the beginning of the neutral palette * )( * () => 1 // While searching, search in the direction toward the end of the array (-1 moves towards the beginning of the array) * )( * minContrastTargetFactory(4.5) // A swatch is only valid if the contrast is greater than 4.5 * )( * designSystem // Pass the design-system. The first swatch that passes the previous condition will be returned from this function * ) */ export declare function swatchByContrast(referenceColor: string | SwatchResolver): (paletteResolver: Palette | DesignSystemResolver) => (indexResolver: (referenceColor: string, palette: Palette, designSystem: DesignSystem) => number) => (directionResolver: (referenceIndex: number, palette: Palette, designSystem: DesignSystem) => 1 | -1) => (contrastCondition: (contrastRatio: number) => boolean) => DesignSystemResolver; /** * Resolves the index that the contrast search algorithm should start at */ export declare function referenceColorInitialIndexResolver(referenceColor: string, sourcePalette: Palette, designSystem: DesignSystem): number; export declare function findClosestBackgroundIndex(designSystem: DesignSystem): number; export declare function minContrastTargetFactory(targetContrast: number): (instanceContrast: number) => boolean;