@telegram-apps/transformers
Version:
Transformation utilities we use in the @telegram-apps packages.
22 lines (21 loc) • 694 B
TypeScript
import { RGB, RGBShort } from '@telegram-apps/types';
/**
* Returns true in case, passed value has #RRGGBB format.
* @param value - value to check.
*/
export declare function isRGB(value: string): value is RGB;
/**
* Returns true in case, passed value has #RGB format.
* @param value - value to check.
*/
export declare function isRGBShort(value: string): value is RGBShort;
/**
* Converts passed value to #RRGGBB format. Accepts following color formats:
* - `#RGB`
* - `#RRGGBB`
* - `rgb(1,2,3)`
* - `rgba(1,2,3,4)`
* @param value - value to convert.
* @throws {Error} Passed value does not satisfy any of known RGB formats.
*/
export declare function toRGB(value: string): RGB;