From 7ecaa31914dec444aa7afd9da446a2df4ee9bb00 Mon Sep 17 00:00:00 2001 From: Chip Cullen Date: Mon, 6 Apr 2026 12:30:17 -0400 Subject: [PATCH] Fix for alpha translation --- src/utils/calculateOverlay.ts | 4 ++-- src/utils/colorStringToArray.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/calculateOverlay.ts b/src/utils/calculateOverlay.ts index 495e4ae..11d5c57 100644 --- a/src/utils/calculateOverlay.ts +++ b/src/utils/calculateOverlay.ts @@ -1,6 +1,6 @@ -import { ASSUMED_BACKGROUND_COLOR } from '../constants'; +import { ASSUMED_BACKGROUND_COLOR } from "../constants"; -const channelResult = (fg: number, bg: number, alpha:number): number => { +const channelResult = (fg: number, bg: number, alpha: number): number => { return Math.floor(alpha * fg + (1 - alpha) * bg); }; diff --git a/src/utils/colorStringToArray.ts b/src/utils/colorStringToArray.ts index c56ae88..f6d83a9 100644 --- a/src/utils/colorStringToArray.ts +++ b/src/utils/colorStringToArray.ts @@ -8,7 +8,7 @@ const colorStringToArray = (colorString: string, returnNum=false, index=4): Arra .split(sep); if (returnNum) { - const colorIntArray = colorArray.map(x => parseInt(x)); + const colorIntArray = colorArray.map(x => parseFloat(x)); return colorIntArray; } else { return colorArray;