Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix(sdk): Add background-light to derived colors for the new embed (#62522)

Timofey Kachalov607e7045370f
diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/utils/dynamic-sdk-color-defaults.ts b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/utils/dynamic-sdk-color-defaults.ts
index 95ff750d120..493547c5bf5 100644
--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/utils/dynamic-sdk-color-defaults.ts
+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/utils/dynamic-sdk-color-defaults.ts
@@ -18,6 +18,10 @@ export const EMBED_FLOW_DERIVED_COLORS_CONFIG: EmbedFlowDerivedDefaultColorConfi
light: { source: "background", darken: 0.05 },
dark: { source: "background", lighten: 0.5 },
},
+ "background-light": {
+ light: { source: "background", darken: 0.02 },
+ dark: { source: "background", lighten: 0.6 },
+ },
"text-secondary": {
light: { source: "text-primary", lighten: 0.3 },
dark: { source: "text-primary", darken: 0.3 },
diff --git a/frontend/src/metabase/embedding-sdk/theme/MetabaseTheme.ts b/frontend/src/metabase/embedding-sdk/theme/MetabaseTheme.ts
index d5c444929ca..79b72d51484 100644
--- a/frontend/src/metabase/embedding-sdk/theme/MetabaseTheme.ts
+++ b/frontend/src/metabase/embedding-sdk/theme/MetabaseTheme.ts
@@ -64,6 +64,9 @@ export interface MetabaseColors {
/** Muted background color used for disabled elements, such as disabled buttons and inputs. */
"background-disabled"?: string;
+ /** Light background color used for some controls like a radiogroup. */
+ "background-light"?: string;
+
/** Color used for borders */
border?: string;
diff --git a/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts b/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts
index cdcaee4ce53..fdc24da21da 100644
--- a/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts
+++ b/frontend/src/metabase/embedding-sdk/theme/embedding-color-palette.ts
@@ -28,6 +28,7 @@ export type SemanticColorKey =
| "background-selected"
| "background-disabled"
| "background-inverse"
+ | "background-light"
| "background-brand"
| "brand-light"
| "brand-lighter";
@@ -53,6 +54,7 @@ export const SDK_TO_MAIN_APP_COLORS_MAPPING: Record<
"background-hover": ["bg-light", "background-hover"],
"background-secondary": ["bg-medium"],
"background-disabled": ["background-disabled"],
+ "background-light": ["background-light"],
shadow: ["shadow"],
positive: ["success"],
negative: ["danger"],
diff --git a/frontend/src/metabase/ui/components/inputs/SegmentedControl/SegmentedControl.config.ts b/frontend/src/metabase/ui/components/inputs/SegmentedControl/SegmentedControl.config.ts
index cb19f7074eb..72841618859 100644
--- a/frontend/src/metabase/ui/components/inputs/SegmentedControl/SegmentedControl.config.ts
+++ b/frontend/src/metabase/ui/components/inputs/SegmentedControl/SegmentedControl.config.ts
@@ -24,6 +24,7 @@ export const segmentedControlOverrides: MantineThemeOverride["components"] = {
root: {
"--sc-active-text-color": props.c ?? "var(--mb-color-text-dark)",
"--sc-background-color": props.bg ?? "var(--mb-color-bg-medium)",
+ "--sc-color": "var(--mb-color-bg-white)",
"--sc-padding": getPadding(theme, props),
"--sc-font-size": theme.fontSizes.md,
},
diff --git a/frontend/src/metabase/ui/utils/colors.ts b/frontend/src/metabase/ui/utils/colors.ts
index 666391a0314..e02b25f2493 100644
--- a/frontend/src/metabase/ui/utils/colors.ts
+++ b/frontend/src/metabase/ui/utils/colors.ts
@@ -53,6 +53,7 @@ const CUSTOM_COLORS = [
"background",
"background-hover",
"background-disabled",
+ "background-light",
"accent-gray",
"accent-gray-light",
] as const;