Add rgb to rgba util

This commit is contained in:
jeffvli 2023-07-20 17:09:10 -07:00
parent ba00538cc3
commit 713260bfc9
2 changed files with 8 additions and 0 deletions

View file

@ -0,0 +1,7 @@
export const rgbToRgba = (rgb: string | undefined, alpha: number) => {
if (!rgb) {
return undefined;
}
return rgb.replace(')', `, ${alpha})`).replace('rgb', 'rgba');
};