From 0d5532f3f293790c6fb26d406b3407996e66de6c Mon Sep 17 00:00:00 2001 From: RayRedGoose Date: Thu, 18 Apr 2024 13:11:10 -0600 Subject: [PATCH] fix: Add transparent value for colors with alpha as 0 --- packages/canvas-tokens/utils/transformers/flatRGBAColor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/canvas-tokens/utils/transformers/flatRGBAColor.ts b/packages/canvas-tokens/utils/transformers/flatRGBAColor.ts index ed58470..9520474 100644 --- a/packages/canvas-tokens/utils/transformers/flatRGBAColor.ts +++ b/packages/canvas-tokens/utils/transformers/flatRGBAColor.ts @@ -13,7 +13,7 @@ export const flatRGBAColor = ({value}: DesignToken): string => { const innerRgb = b.replace(/rgba\(([^}]+)/g, (__: string, c: string) => c.split(',').slice(0, 3).toString() ); - return `rgba(${innerRgb},${alpha})`; + return alpha === '0' ? 'transparent' : `rgba(${innerRgb},${alpha})`; }); return rgba;