Skip to content

Commit

Permalink
move clampRGBA to separate PR
Browse files Browse the repository at this point in the history
  • Loading branch information
patrycjakalinska committed Dec 16, 2024
1 parent 9bace78 commit e43a655
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions packages/react-native-reanimated/src/Colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ function parsePercentage(str: string): number {
return int / 100;
}

function clampRGBA(RGBA: ParsedColorArray): void {
'worklet';
for (let i = 0; i < 4; i++) {
RGBA[i] = Math.max(0, Math.min(RGBA[i], 1));
}
}

const names: Record<string, number> = makeShareable({
transparent: 0x00000000,

Expand Down Expand Up @@ -721,7 +714,6 @@ export function convertToRGBA(color: unknown): ParsedColorArray {

export function rgbaArrayToRGBAColor(RGBA: ParsedColorArray): string {
'worklet';
clampRGBA(RGBA);
const alpha = RGBA[3] < 0.001 ? 0 : RGBA[3];
return `rgba(${Math.round(RGBA[0] * 255)}, ${Math.round(
RGBA[1] * 255
Expand All @@ -747,7 +739,6 @@ export function toGammaSpace(
): ParsedColorArray {
'worklet';
const res = [];
clampRGBA(RGBA);
for (let i = 0; i < 3; ++i) {
res.push(Math.pow(RGBA[i], 1 / gamma));
}
Expand Down

0 comments on commit e43a655

Please sign in to comment.