rusackas commented on code in PR #42053:
URL: https://github.com/apache/superset/pull/42053#discussion_r3732205971


##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts:
##########
@@ -270,19 +274,35 @@ export const getColorFunction = (
     if (compareResult === false) return undefined;
     const { cutoffValue, extremeValue } = compareResult;
 
+    if (typeof colorScheme === 'string') {
+      if (isSpecialColor(colorScheme)) {
+        return colorScheme;
+      }
+      if (useGradient === false) {
+        return colorScheme;
+      }
+      if (alpha === undefined || alpha) {
+        return addAlpha(
+          colorScheme,
+          getOpacity(value, cutoffValue, extremeValue, minOpacity, maxOpacity),
+        );
+      }
+      return colorScheme;
+    }
+    const baseHexColor = rgbaToHex({ ...colorScheme, a: 1 });

Review Comment:
   Confirmed, the opaque override is now gated behind alpha === false instead 
of applying unconditionally, so disabling gradients no longer clobbers the 
picked alpha.



##########
superset-frontend/packages/superset-ui-chart-controls/src/types.ts:
##########
@@ -494,7 +495,7 @@ export type ConditionalFormattingConfig = {
   targetValueLeft?: number;
   targetValueRight?: number;
   column?: string;
-  colorScheme?: string;
+  colorScheme?: RGBColor | string;

Review Comment:
   I think this is a false positive, rgbaToHex already destructures with a 
default (const { r, g, b, a = 1 } = rgb), so nothing accesses .a unguarded even 
with the looser RGBColor type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to