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

@ -6,3 +6,4 @@ export * from './title-case';
export * from './get-header-color';
export * from './parse-search-params';
export * from './format-duration-string';
export * from './rgb-to-rgba';

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');
};