@rashedmakkouk/dev-utils
Version:
Utility library.
14 lines (13 loc) • 506 B
TypeScript
/** Typings */
import { KEYWORD } from 'color-convert/conversions';
/**
* Converts color from 'keyword' (e.g. green) or 'hex' (e.g. #00FF00) to RGBa
* value. Useful when there is a need to apply color opacity.
*
* @param color - Color `Name` or `HEX` value.
* @param alpha - Alpha channel `opacity` between '0' and '1'; default 1.
*
* @returns RGBa value for valid colors else 'rgba(0,0,0,alpha)'.
*/
declare function toRGBa(color: KEYWORD | string, alpha?: number): string;
export default toRGBa;