contrastrast
Version:
A lightweight tool that parses color strings and recommends text contrast based on WCAG Standards
15 lines • 1.16 kB
TypeScript
import { ContrastrastOptions } from "../types/contrastrastOptionts.types.js";
/**
* Recommends to use either `light` or `dark` text based on the
* given background color.
*
* Color string can be HEX, RGB, or HSL
*
* @param {String} bgColorString Color string of the background. Can be HEX, RGB, or HSL
* @param {ContrastrastOptions} options (Optional) Partial collection `ContrastrastOptions` that you wish you apply
* @param {"dark"|"light"} [options.fallbackOption="dark"] Fallback color recommendation, returns on error or unparsable color string. Defaults to `dark`
* @param {Boolean} [options.throwErrorOnUnhandled=false] Force option to throw error when invalid/unhandled color string is passed. Defaults to `false`
* @return {"dark"|"light"} Text color recommendation for given color string
*/
export declare const textContrastForBGColor: (bgColorString: string, options?: Partial<ContrastrastOptions>) => "dark" | "light";
//# sourceMappingURL=textContrastForBGColor.d.ts.map