Add rgb to rgba util
This commit is contained in:
parent
ba00538cc3
commit
713260bfc9
2 changed files with 8 additions and 0 deletions
|
@ -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';
|
||||
|
|
7
src/renderer/utils/rgb-to-rgba.ts
Normal file
7
src/renderer/utils/rgb-to-rgba.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export const rgbToRgba = (rgb: string | undefined, alpha: number) => {
|
||||
if (!rgb) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return rgb.replace(')', `, ${alpha})`).replace('rgb', 'rgba');
|
||||
};
|
Reference in a new issue