UNPKG

@voiceiq/web-components

Version:

VoiceIQ Web Component library

71 lines (70 loc) 2.64 kB
import { SecondaryColourSet } from '../../Theme/Colours'; /** * Utility class to manage colour functions */ declare class ColourUtil { colourOptions: string[]; /** * Validates a given string to be a valid colour string * * @param {string} colour Colour string to validate * @return {boolean} True if the given colour is a valid colour */ isColour: (colour: string | null | undefined) => boolean; /** * Gets the contrasting colour to use for the foreground text * * @param {string} backgroundColour Background colour hex code * @return {string} Contrasting colour to the given background */ getContrastingTextColour: (backgroundColour: string) => string; /** * Gets the matching secondary colour set from a given colour * * @param {string} colourOption Colour option to search * @param {SecondaryColourSet | undefined} defaultValue Default value to return if not found * @returns {SecondaryColourSet | undefined} The result */ getMatchingSecondaryColourPaletteFromNormal: (colourOption: string, defaultValue?: SecondaryColourSet | undefined) => SecondaryColourSet | undefined; /** * Gets a deterministic Colour matching the given text * * @param {string} value Value to match * @returns {string} Matching colour */ getBackgroundColourOfString: (value: string) => string; /** * Gets the matching background colour of a colour option * The colour option MUST be a selection from the Design Library * * @param {string} colourOption The colour option to query * @returns {string | null} The matching background colour */ getBackgroundColourOfColourOption: (colourOption: string) => string | null; } export declare enum SecondaryPalette { red = "Red", orange = "Orange", yellow = "Yellow", green = "Green", teal = "Teal", blue = "Blue", darkBlue = "DarkBlue", indigo = "Indigo", purple = "Purple", darkGrey = "DarkGrey" } export declare const SecondaryPaletteColourSetMap: { Red: SecondaryColourSet; Orange: SecondaryColourSet; Yellow: SecondaryColourSet; Green: SecondaryColourSet; Teal: SecondaryColourSet; Blue: SecondaryColourSet; DarkBlue: SecondaryColourSet; Indigo: SecondaryColourSet; Purple: SecondaryColourSet; DarkGrey: SecondaryColourSet; }; declare const _default: ColourUtil; export default _default;