Skip to content

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

Improve readability of Delete permanently button on dark toasts (#84809)

Egor Grushin54e48c977817
diff --git a/.loki/reference/chrome_laptop_Components_Buttons_Button_Variant_On_Dark.png b/.loki/reference/chrome_laptop_Components_Buttons_Button_Variant_On_Dark.png
index 3891df7b87d..c6cf56b1640 100644
Binary files a/.loki/reference/chrome_laptop_Components_Buttons_Button_Variant_On_Dark.png and b/.loki/reference/chrome_laptop_Components_Buttons_Button_Variant_On_Dark.png differ
diff --git a/.loki/reference/chrome_laptop_Design_System_Colors_Default.png b/.loki/reference/chrome_laptop_Design_System_Colors_Default.png
index 7515def9ab0..821ce345c8d 100644
Binary files a/.loki/reference/chrome_laptop_Design_System_Colors_Default.png and b/.loki/reference/chrome_laptop_Design_System_Colors_Default.png differ
diff --git a/frontend/src/metabase/common/components/BulkActionBar/BulkActionButton.tsx b/frontend/src/metabase/common/components/BulkActionBar/BulkActionButton.tsx
index 4229f325bef..96064c7b732 100644
--- a/frontend/src/metabase/common/components/BulkActionBar/BulkActionButton.tsx
+++ b/frontend/src/metabase/common/components/BulkActionBar/BulkActionButton.tsx
@@ -2,21 +2,20 @@ import { forwardRef } from "react";
import { Button, type ButtonProps } from "metabase/ui";
-type BulkActionButtonProps = Omit<ButtonProps, "variant"> & {
+type BulkActionButtonProps = Omit<ButtonProps, "variant" | "c"> & {
danger?: boolean;
};
export const BulkActionButton = forwardRef<
HTMLButtonElement,
BulkActionButtonProps
->(function BulkActionButton({ danger = false, c, disabled, ...props }, ref) {
+>(function BulkActionButton({ danger = false, color, ...props }, ref) {
return (
<Button
{...props}
ref={ref}
- disabled={disabled}
variant="on-dark-secondary"
- c={danger && !disabled ? "feedback-negative" : c}
+ color={danger ? "negative" : color}
/>
);
});
diff --git a/frontend/src/metabase/common/components/Toaster/Toaster.module.css b/frontend/src/metabase/common/components/Toaster/Toaster.module.css
index fdcc2e5190f..79980f1ea99 100644
--- a/frontend/src/metabase/common/components/Toaster/Toaster.module.css
+++ b/frontend/src/metabase/common/components/Toaster/Toaster.module.css
@@ -75,12 +75,12 @@
}
.dismiss:hover {
- background-color: var(--mb-color-button-on_dark-secondary-hover);
+ background-color: var(--mb-color-button-on_dark_secondary-neutral-hover);
color: var(--mb-color-tooltip-text);
}
.dismiss:active {
- background-color: var(--mb-color-button-on_dark-secondary-pressed);
+ background-color: var(--mb-color-button-on_dark_secondary-neutral-pressed);
}
.toast[data-variant="negative"],
diff --git a/frontend/src/metabase/ui/colors/constants/themes/dark.ts b/frontend/src/metabase/ui/colors/constants/themes/dark.ts
index 28800b9b615..8ccb8afcdf7 100644
--- a/frontend/src/metabase/ui/colors/constants/themes/dark.ts
+++ b/frontend/src/metabase/ui/colors/constants/themes/dark.ts
@@ -104,12 +104,20 @@ export const getDarkTheme = (
"button-light-positive-hover": baseColors.orionAlphaInverse[20],
"button-light-positive-pressed": baseColors.orionAlphaInverse[10],
"button-on_dark-disabled": baseColors.orionAlphaInverse[10],
- "button-on_dark-primary-default": baseColors.white,
- "button-on_dark-primary-hover": baseColors.orion[20],
- "button-on_dark-primary-pressed": baseColors.orion[30],
- "button-on_dark-secondary-default": baseColors.orionAlphaInverse[10],
- "button-on_dark-secondary-hover": baseColors.orionAlphaInverse[20],
- "button-on_dark-secondary-pressed": baseColors.orionAlphaInverse[10],
+ "button-on_dark_primary-negative-default": baseColors.lobster[20],
+ "button-on_dark_primary-negative-hover": baseColors.lobster[10],
+ "button-on_dark_primary-negative-pressed": baseColors.lobster[20],
+ "button-on_dark_primary-neutral-default": baseColors.white,
+ "button-on_dark_primary-neutral-hover": baseColors.orion[20],
+ "button-on_dark_primary-neutral-pressed": baseColors.orion[30],
+ "button-on_dark_secondary-negative-default": baseColors.blackAlpha[10],
+ "button-on_dark_secondary-negative-hover": baseColors.orionAlphaInverse[10],
+ "button-on_dark_secondary-negative-pressed": baseColors.blackAlpha[10],
+ "button-on_dark_secondary-neutral-default":
+ baseColors.orionAlphaInverse[10],
+ "button-on_dark_secondary-neutral-hover": baseColors.orionAlphaInverse[20],
+ "button-on_dark_secondary-neutral-pressed":
+ baseColors.orionAlphaInverse[10],
"button-subtle-brand-default": baseColors.transparent,
"button-subtle-brand-hover": baseColors.orionAlphaInverse[20],
"button-subtle-brand-pressed": baseColors.orionAlphaInverse[10],
@@ -141,8 +149,10 @@ export const getDarkTheme = (
"button_label-light-positive-default": baseColors.palm[30],
"button_label-light-positive-hover": baseColors.palm[20],
"button_label-on_dark-disabled": baseColors.orionAlphaInverse[40],
- "button_label-on_dark-primary": baseColors.orionAlpha[80],
- "button_label-on_dark-secondary": baseColors.white,
+ "button_label-on_dark_primary-negative-default": baseColors.lobster[70],
+ "button_label-on_dark_primary-neutral-default": baseColors.orionAlpha[80],
+ "button_label-on_dark_secondary-negative-default": baseColors.lobster[30],
+ "button_label-on_dark_secondary-neutral-default": baseColors.white,
"button_label-subtle-brand-default": brand[30],
"button_label-subtle-brand-hover": brand[20],
"button_label-subtle-negative-default": baseColors.lobster[30],
diff --git a/frontend/src/metabase/ui/colors/constants/themes/light.ts b/frontend/src/metabase/ui/colors/constants/themes/light.ts
index 67b5b24f18e..9fc7aaf2d5e 100644
--- a/frontend/src/metabase/ui/colors/constants/themes/light.ts
+++ b/frontend/src/metabase/ui/colors/constants/themes/light.ts
@@ -109,12 +109,20 @@ export const getLightTheme = (
"button-light-positive-hover": baseColors.palmAlpha[20],
"button-light-positive-pressed": baseColors.palmAlpha[30],
"button-on_dark-disabled": baseColors.orionAlphaInverse[10],
- "button-on_dark-primary-default": baseColors.white,
- "button-on_dark-primary-hover": baseColors.orion[20],
- "button-on_dark-primary-pressed": baseColors.orion[30],
- "button-on_dark-secondary-default": baseColors.orionAlphaInverse[10],
- "button-on_dark-secondary-hover": baseColors.orionAlphaInverse[20],
- "button-on_dark-secondary-pressed": baseColors.orionAlphaInverse[10],
+ "button-on_dark_primary-negative-default": baseColors.lobster[20],
+ "button-on_dark_primary-negative-hover": baseColors.lobster[10],
+ "button-on_dark_primary-negative-pressed": baseColors.lobster[20],
+ "button-on_dark_primary-neutral-default": baseColors.white,
+ "button-on_dark_primary-neutral-hover": baseColors.orion[20],
+ "button-on_dark_primary-neutral-pressed": baseColors.orion[30],
+ "button-on_dark_secondary-negative-default": baseColors.blackAlpha[10],
+ "button-on_dark_secondary-negative-hover": baseColors.orionAlphaInverse[10],
+ "button-on_dark_secondary-negative-pressed": baseColors.blackAlpha[10],
+ "button-on_dark_secondary-neutral-default":
+ baseColors.orionAlphaInverse[10],
+ "button-on_dark_secondary-neutral-hover": baseColors.orionAlphaInverse[20],
+ "button-on_dark_secondary-neutral-pressed":
+ baseColors.orionAlphaInverse[10],
"button-subtle-brand-default": baseColors.transparent,
"button-subtle-brand-hover":
"color-mix(in srgb, var(--mb-color-core-brand) 21%, transparent)",
@@ -148,8 +156,10 @@ export const getLightTheme = (
"button_label-light-positive-default": baseColors.palm[70],
"button_label-light-positive-hover": baseColors.palm[80],
"button_label-on_dark-disabled": baseColors.orionAlphaInverse[40],
- "button_label-on_dark-primary": baseColors.orionAlpha[80],
- "button_label-on_dark-secondary": baseColors.white,
+ "button_label-on_dark_primary-negative-default": baseColors.lobster[70],
+ "button_label-on_dark_primary-neutral-default": baseColors.orionAlpha[80],
+ "button_label-on_dark_secondary-negative-default": baseColors.lobster[30],
+ "button_label-on_dark_secondary-neutral-default": baseColors.white,
"button_label-subtle-brand-default": brand[60],
"button_label-subtle-brand-hover": brand[70],
"button_label-subtle-negative-default": baseColors.lobster[70],
diff --git a/frontend/src/metabase/ui/colors/types/color-keys.ts b/frontend/src/metabase/ui/colors/types/color-keys.ts
index 23421abfd10..7d5d66ee787 100644
--- a/frontend/src/metabase/ui/colors/types/color-keys.ts
+++ b/frontend/src/metabase/ui/colors/types/color-keys.ts
@@ -97,12 +97,18 @@ export type MetabaseColorKey =
| "button-light-positive-hover"
| "button-light-positive-pressed"
| "button-on_dark-disabled"
- | "button-on_dark-primary-default"
- | "button-on_dark-primary-hover"
- | "button-on_dark-primary-pressed"
- | "button-on_dark-secondary-default"
- | "button-on_dark-secondary-hover"
- | "button-on_dark-secondary-pressed"
+ | "button-on_dark_primary-negative-default"
+ | "button-on_dark_primary-negative-hover"
+ | "button-on_dark_primary-negative-pressed"
+ | "button-on_dark_primary-neutral-default"
+ | "button-on_dark_primary-neutral-hover"
+ | "button-on_dark_primary-neutral-pressed"
+ | "button-on_dark_secondary-negative-default"
+ | "button-on_dark_secondary-negative-hover"
+ | "button-on_dark_secondary-negative-pressed"
+ | "button-on_dark_secondary-neutral-default"
+ | "button-on_dark_secondary-neutral-hover"
+ | "button-on_dark_secondary-neutral-pressed"
| "button-subtle-brand-default"
| "button-subtle-brand-hover"
| "button-subtle-brand-pressed"
@@ -134,8 +140,10 @@ export type MetabaseColorKey =
| "button_label-light-positive-default"
| "button_label-light-positive-hover"
| "button_label-on_dark-disabled"
- | "button_label-on_dark-primary"
- | "button_label-on_dark-secondary"
+ | "button_label-on_dark_primary-negative-default"
+ | "button_label-on_dark_primary-neutral-default"
+ | "button_label-on_dark_secondary-negative-default"
+ | "button_label-on_dark_secondary-neutral-default"
| "button_label-subtle-brand-default"
| "button_label-subtle-brand-hover"
| "button_label-subtle-negative-default"
diff --git a/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.config.tsx b/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.config.tsx
index 5559e9a4121..376c170a94f 100644
--- a/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.config.tsx
+++ b/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.config.tsx
@@ -25,31 +25,47 @@ const ACTION_ICON_COLORS = [
"neutral",
] as const satisfies readonly ActionIconColor[];
+const CELL_VARIANTS = {
+ default: "default",
+ filled: "filled",
+ light: "light",
+ subtle: "subtle",
+ "on-dark-primary": "on_dark_primary",
+ "on-dark-secondary": "on_dark_secondary",
+} as const satisfies Record<ActionIconVariant, string>;
+
const DEFAULT_COLORS: Partial<Record<ActionIconVariant, ActionIconColor>> = {
default: "neutral",
filled: "brand",
light: "neutral",
subtle: "neutral",
+ "on-dark-primary": "neutral",
+ "on-dark-secondary": "neutral",
};
const CELLS = [
"default-neutral",
"filled-brand",
"light-neutral",
+ "on_dark_primary-neutral",
+ "on_dark_secondary-neutral",
"subtle-brand",
"subtle-negative",
"subtle-neutral",
"subtle-positive",
"subtle-warning",
-] as const satisfies readonly `${ActionIconVariant}-${ActionIconColor}`[];
+] as const satisfies readonly `${CellVariant}-${ActionIconColor}`[];
const DEFAULT_LABEL_HOVER_CELLS = [
"default-neutral",
"filled-brand",
"light-neutral",
+ "on_dark_primary-neutral",
+ "on_dark_secondary-neutral",
"subtle-neutral",
] as const satisfies readonly Cell[];
+type CellVariant = (typeof CELL_VARIANTS)[ActionIconVariant];
type Cell = (typeof CELLS)[number];
type DefaultLabelHoverCell = (typeof DEFAULT_LABEL_HOVER_CELLS)[number];
@@ -70,12 +86,13 @@ const getCell = (
iconColor: MantineActionIconProps["color"],
): Cell | undefined => {
const defaultColor = DEFAULT_COLORS[variant];
+ const cellVariant = CELL_VARIANTS[variant];
const cellColor = isActionIconColor(iconColor) ? iconColor : defaultColor;
- const cell = `${variant}-${cellColor}`;
+ const cell = `${cellVariant}-${cellColor}`;
if (isCell(cell)) {
return cell;
}
- const defaultCell = `${variant}-${defaultColor}`;
+ const defaultCell = `${cellVariant}-${defaultColor}`;
return isCell(defaultCell) ? defaultCell : undefined;
};
diff --git a/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css b/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css
index e8624f6bf44..2b74793dcba 100644
--- a/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css
+++ b/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css
@@ -108,20 +108,10 @@
}
.root[data-variant="on-dark-primary"] {
- --ai-color: var(--mb-color-button_label-on_dark-primary);
- --ai-hover-color: var(--mb-color-button_label-on_dark-primary);
- --ai-bg: var(--mb-color-button-on_dark-primary-default);
- --ai-hover: var(--mb-color-button-on_dark-primary-hover);
- --ai-pressed: var(--mb-color-button-on_dark-primary-pressed);
--ai-bd: 0.5px solid transparent;
}
.root[data-variant="on-dark-secondary"] {
- --ai-color: var(--mb-color-button_label-on_dark-secondary);
- --ai-hover-color: var(--mb-color-button_label-on_dark-secondary);
- --ai-bg: var(--mb-color-button-on_dark-secondary-default);
- --ai-hover: var(--mb-color-button-on_dark-secondary-hover);
- --ai-pressed: var(--mb-color-button-on_dark-secondary-pressed);
--ai-bd: 0.5px solid var(--mb-color-border-on_dark);
}
diff --git a/frontend/src/metabase/ui/components/buttons/Button/Button.config.tsx b/frontend/src/metabase/ui/components/buttons/Button/Button.config.tsx
index 0b2721d76b7..fbf077c8c97 100644
--- a/frontend/src/metabase/ui/components/buttons/Button/Button.config.tsx
+++ b/frontend/src/metabase/ui/components/buttons/Button/Button.config.tsx
@@ -24,12 +24,24 @@ const BUTTON_COLORS = [
"neutral",
] as const satisfies readonly ButtonColor[];
+const CELL_VARIANTS = {
+ default: "default",
+ filled: "filled",
+ light: "light",
+ subtle: "subtle",
+ transparent: "subtle",
+ "on-dark-primary": "on_dark_primary",
+ "on-dark-secondary": "on_dark_secondary",
+} as const satisfies Record<ButtonVariant, string>;
+
const DEFAULT_COLORS: Partial<Record<ButtonVariant, ButtonColor>> = {
default: "neutral",
filled: "brand",
light: "brand",
subtle: "brand",
transparent: "brand",
+ "on-dark-primary": "neutral",
+ "on-dark-secondary": "neutral",
};
const CELLS = [
@@ -44,11 +56,15 @@ const CELLS = [
"light-negative",
"light-neutral",
"light-positive",
+ "on_dark_primary-negative",
+ "on_dark_primary-neutral",
+ "on_dark_secondary-negative",
+ "on_dark_secondary-neutral",
"subtle-brand",
"subtle-negative",
"subtle-neutral",
"subtle-positive",
-] as const satisfies readonly `${ButtonVariant}-${ButtonColor}`[];
+] as const satisfies readonly `${CellVariant}-${ButtonColor}`[];
const DEFAULT_LABEL_HOVER_CELLS = [
"default-neutral",
@@ -58,9 +74,14 @@ const DEFAULT_LABEL_HOVER_CELLS = [
"filled-positive",
"filled-warning",
"light-neutral",
+ "on_dark_primary-negative",
+ "on_dark_primary-neutral",
+ "on_dark_secondary-negative",
+ "on_dark_secondary-neutral",
"subtle-neutral",
] as const satisfies readonly Cell[];
+type CellVariant = (typeof CELL_VARIANTS)[ButtonVariant];
type Cell = (typeof CELLS)[number];
type DefaultLabelHoverCell = (typeof DEFAULT_LABEL_HOVER_CELLS)[number];
@@ -81,7 +102,7 @@ const getCell = (
buttonColor: MantineButtonProps["color"],
): Cell | undefined => {
const defaultColor = DEFAULT_COLORS[variant];
- const cellVariant = variant === "transparent" ? "subtle" : variant;
+ const cellVariant = CELL_VARIANTS[variant];
const cellColor = isButtonColor(buttonColor) ? buttonColor : defaultColor;
const cell = `${cellVariant}-${cellColor}`;
if (isCell(cell)) {
diff --git a/frontend/src/metabase/ui/components/buttons/Button/Button.mdx b/frontend/src/metabase/ui/components/buttons/Button/Button.mdx
index f84e5d9c8c8..7d4ace7d4c8 100644
--- a/frontend/src/metabase/ui/components/buttons/Button/Button.mdx
+++ b/frontend/src/metabase/ui/components/buttons/Button/Button.mdx
@@ -60,6 +60,8 @@ Not to use:
### Variant: On Dark
+`on-dark-primary` and `on-dark-secondary` are meant for dark surfaces that stay dark in both color schemes (toasts, banners). Pass `color="negative"` for destructive actions.
+
<Canvas of={ButtonStories.VariantOnDark} />
### Compact
diff --git a/frontend/src/metabase/ui/components/buttons/Button/Button.module.css b/frontend/src/metabase/ui/components/buttons/Button/Button.module.css
index 2d0ba568b45..64e06629b94 100644
--- a/frontend/src/metabase/ui/components/buttons/Button/Button.module.css
+++ b/frontend/src/metabase/ui/components/buttons/Button/Button.module.css
@@ -142,20 +142,10 @@
}
.root[data-variant="on-dark-primary"] {
- --button-color: var(--mb-color-button_label-on_dark-primary);
- --button-hover-color: var(--mb-color-button_label-on_dark-primary);
- --button-bg: var(--mb-color-button-on_dark-primary-default);
- --button-hover: var(--mb-color-button-on_dark-primary-hover);
- --button-pressed: var(--mb-color-button-on_dark-primary-pressed);
--button-bd: 0.5px solid transparent;
}
.root[data-variant="on-dark-secondary"] {
- --button-color: var(--mb-color-button_label-on_dark-secondary);
- --button-hover-color: var(--mb-color-button_label-on_dark-secondary);
- --button-bg: var(--mb-color-button-on_dark-secondary-default);
- --button-hover: var(--mb-color-button-on_dark-secondary-hover);
- --button-pressed: var(--mb-color-button-on_dark-secondary-pressed);
--button-bd: 0.5px solid var(--mb-color-border-on_dark);
}
diff --git a/frontend/src/metabase/ui/components/buttons/Button/Button.stories.tsx b/frontend/src/metabase/ui/components/buttons/Button/Button.stories.tsx
index 9df2bc2d895..3012ee3bf10 100644
--- a/frontend/src/metabase/ui/components/buttons/Button/Button.stories.tsx
+++ b/frontend/src/metabase/ui/components/buttons/Button/Button.stories.tsx
@@ -382,12 +382,24 @@ const OnDarkTemplate = () => (
color="brand"
sizes={MATRIX_SIZES}
/>
+ <MatrixSection
+ title="Primary · Negative"
+ variant="on-dark-primary"
+ color="negative"
+ sizes={MATRIX_SIZES}
+ />
<MatrixSection
title="Secondary"
variant="on-dark-secondary"
color="brand"
sizes={MATRIX_SIZES}
/>
+ <MatrixSection
+ title="Secondary · Negative"
+ variant="on-dark-secondary"
+ color="negative"
+ sizes={MATRIX_SIZES}
+ />
</StoryBoard>
);