@devlander/colors
Version:
Color utility package used between packages
9 lines (8 loc) • 537 B
TypeScript
import { HexDecimalObject } from "./types/hex-decimal-object.interface";
/**
* Parses an RGB or RGBA string and returns an object with the red, green, blue, and optionally alpha components.
*
* @param {string} color - The RGB or RGBA string to parse (e.g., "rgb(255, 255, 255)", "rgba(255, 255, 255, 0.5)", "rgb(100%, 0%, 0%)", or "rgba(100%, 0%, 0%, 0.5)").
* @returns {HexDecimalObject | null} The RGB components or null if the input is invalid.
*/
export declare const parseRgbString: (color: string) => HexDecimalObject | null;