contrastrast
Version:
A lightweight tool that parses color strings and recommends text contrast based on WCAG Standards
33 lines • 1.59 kB
TypeScript
import { RGBValues } from "../types/RGB.types.js";
/**
* Converts a HEX color value to RGB
* Assumes hex code has the `#` stripped and is in 3 or 6 length configuration
* returns r, g, and b in the set [0, 255].
*
* @param {string} hexString 3 or 6 length hex code string with `#` removed
* @return {RGBValues} The RGB representation
*/
export declare const extractRGBValuesFromHex: (hexString: string) => RGBValues;
/**
* HSL to RGB Parser from https://gist.github.com/mjackson/5311256
* Converts an HSL color value to RGB. Conversion formula
* adapted from https://en.wikipedia.org/wiki/HSL_color_space.
* Assumes h, s, and l are contained in the set [0, 1] and
* returns r, g, and b in the set [0, 255].
*
* @param {string} hueString The hue
* @param {string} saturationString The saturation
* @param {string} lightString The lightness
* @return {RGBValues} The RGB representation
*/
export declare const extractRGBValuesFromHSL: (hueString: string, saturationString: string, lightString: string) => RGBValues;
/**
* Parses and formats RGBValues from red, green, blue string values
*
* @param {string} redString The hue
* @param {string} greenString The saturation
* @param {string} blueString The lightness
* @return {RGBValues} The RGB representation
*/
export declare const extractRGBValuesFromRGBStrings: (redString: string, greenString: string, blueString: string) => RGBValues;
//# sourceMappingURL=rgbConverters.d.ts.map