mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
Add rgb to rgba util
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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 New Issue
Block a user