Skip to content

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

Add new color tokens alongside existing ones (#75227)

Oleh K53baf39e82fc
diff --git a/.loki/reference/chrome_laptop_Design_System_Colors_Default.png b/.loki/reference/chrome_laptop_Design_System_Colors_Default.png
index 092a5aab387..95008aa360c 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/ui/colors/constants/color-names.ts b/frontend/src/metabase/ui/colors/constants/color-names.ts
index 699c2712c3a..441e0c9a177 100644
--- a/frontend/src/metabase/ui/colors/constants/color-names.ts
+++ b/frontend/src/metabase/ui/colors/constants/color-names.ts
@@ -1,9 +1,10 @@
import type { MetabaseColorKey } from "../types";
+import { DERIVED_COLOR_KEYS } from "../types/theme";
import { ALL_ACCENT_COLOR_NAMES } from "./accents";
import { METABASE_LIGHT_THEME } from "./themes/light";
/** All color names available in Metabase themes. */
-export const ALL_COLOR_NAMES = Object.keys(METABASE_LIGHT_THEME.colors).concat(
- ALL_ACCENT_COLOR_NAMES,
-) as MetabaseColorKey[];
+export const ALL_COLOR_NAMES = Object.keys(METABASE_LIGHT_THEME.colors)
+ .concat(ALL_ACCENT_COLOR_NAMES)
+ .concat(DERIVED_COLOR_KEYS) as MetabaseColorKey[];
diff --git a/frontend/src/metabase/ui/colors/constants/protected-colors.ts b/frontend/src/metabase/ui/colors/constants/protected-colors.ts
index 5ccb960b06a..15638209c99 100644
--- a/frontend/src/metabase/ui/colors/constants/protected-colors.ts
+++ b/frontend/src/metabase/ui/colors/constants/protected-colors.ts
@@ -6,12 +6,16 @@ import type { MetabaseColorKey } from "../types/color-keys";
*/
export const PROTECTED_COLORS = [
// Metabase's own brand
- "metabase-brand",
+ "metabase-brand", // Legacy
+ "core-metabase_brand",
// Admin-only UI colors
- "admin-navbar",
- "admin-navbar-secondary",
- "admin-navbar-inverse",
+ "admin-navbar", // Legacy
+ "admin-navbar-secondary", // Legacy
+ "admin-navbar-inverse", // Legacy
+ "navbar-admin",
+ "navbar-admin-secondary",
+ "navbar-admin-inverse",
// Accent colors must be set thru the `chartColors` API, not set directly
"accent0",
diff --git a/frontend/src/metabase/ui/colors/constants/themes/dark.ts b/frontend/src/metabase/ui/colors/constants/themes/dark.ts
index 1390d231bf6..d196d0922c7 100644
--- a/frontend/src/metabase/ui/colors/constants/themes/dark.ts
+++ b/frontend/src/metabase/ui/colors/constants/themes/dark.ts
@@ -5,6 +5,181 @@ import { getBaseColorsForThemeDefinitionOnly } from "../base-colors";
const baseColors = getBaseColorsForThemeDefinitionOnly();
+// To be removed once the rename in GDGT-2517 is complete. Prefer the keys in
+// `actualColors` below.
+const deprecatedColors = {
+ "admin-navbar": baseColors.octopus[80],
+ "admin-navbar-secondary": baseColors.octopus[60],
+ "admin-navbar-inverse": baseColors.octopus[60],
+ "background-brand": baseColors.brand[90],
+ "background-filter": baseColors.filter[90],
+ "background-disabled": baseColors.orionAlphaInverse[10],
+ "background-disabled-inverse": baseColors.orionAlpha[10],
+ "background-error-secondary": baseColors.lobster[90],
+ "background-highlight":
+ "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
+ "background-hover":
+ "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
+ "background-selected":
+ "color-mix(in srgb, var(--mb-color-brand) 21%, transparent)",
+ "background-primary": baseColors.orion[100],
+ "background-secondary": baseColors.orion[110],
+ "background-tertiary": baseColors.orion[80],
+ "background-primary-inverse": baseColors.orion[20],
+ "background-secondary-inverse": baseColors.orion[30],
+ "background-tertiary-inverse": baseColors.orion[70],
+ overlay: baseColors.orionAlpha[70],
+ "background-error": baseColors.lobster[90],
+ "background-success": baseColors.palm[90],
+ "background-success-secondary": baseColors.palm[70],
+ brand: baseColors.blue[40],
+ "brand-hover": baseColors.brand[30],
+ danger: baseColors.lobster[50],
+ error: baseColors.lobster[50],
+ filter: baseColors.octopus[40],
+ focus: baseColors.blue[70],
+ "icon-brand": baseColors.brand[40],
+ "icon-primary": baseColors.orionAlphaInverse[80],
+ "icon-disabled": baseColors.orionAlphaInverse[30],
+ "icon-secondary": baseColors.orionAlphaInverse[50],
+ "illustration-brand-secondary": baseColors.brand[80],
+ "illustration-brand-tertiary": baseColors.brand[90],
+ "metabase-brand": baseColors.blue[40],
+ "metabase-brand-hover": baseColors.blue[50],
+ "saturated-blue": baseColors.ocean[40],
+ "saturated-green": baseColors.palm[40],
+ "saturated-purple": baseColors.octopus[40],
+ "saturated-red": baseColors.lobster[40],
+ "saturated-yellow": baseColors.dubloon[30],
+ shadow: `color-mix(in srgb, ${baseColors.orion[110]} 20%, transparent)`,
+ "success-secondary": baseColors.palm[40],
+ success: baseColors.palm[50],
+ summarize: baseColors.palm[40],
+ "syntax-parameters-active": baseColors.mango[90],
+ "syntax-parameters": baseColors.mango[40],
+ "text-tertiary": baseColors.orionAlphaInverse[40],
+ "text-tertiary-inverse": baseColors.orionAlpha[40],
+ "text-hover": baseColors.brand[30],
+ "text-secondary-opaque": baseColors.orion[20],
+ warning: baseColors.dubloon[30],
+ "background-warning": baseColors.dubloon[90],
+ "background-warning-secondary": baseColors.dubloon[70],
+ info: baseColors.orion[50],
+ "background-info": baseColors.orion[90],
+ white: baseColors.orion[110],
+ border: baseColors.orionAlphaInverse[20],
+ "border-strong": baseColors.orionAlphaInverse[30],
+ "border-stronger": baseColors.orionAlphaInverse[50],
+ "border-subtle": baseColors.orionAlphaInverse[10],
+ copper: "#B87333",
+ bronze: "#CD7F32",
+ silver: "#C0C0C0",
+ gold: "#FFD700",
+ "upsell-primary": baseColors.ocean[30],
+ "upsell-secondary": baseColors.ocean[80],
+ "upsell-gem": "#00d4ff",
+};
+
+const actualColors = {
+ "background_page-filter": baseColors.filter[90],
+ "background_page-highlighted":
+ "color-mix(in srgb, var(--mb-color-core-brand) 7%, transparent)",
+ "background_page-primary": baseColors.orion[100],
+ "background_page-primary-inverse": "white",
+ "background_page-secondary":
+ "color-mix(in srgb, var(--mb-color-background_page-primary), black 25%)",
+ "background_page-secondary-inverse": baseColors.orion[5],
+ "background_page-tertiary":
+ "color-mix(in srgb, var(--mb-color-background_page-primary), black 50%)",
+ "background_page-tertiary-inverse": baseColors.orion[10],
+ "background_surface-brand-strong": baseColors.brand[20],
+ "background_surface-brand-strong-hover": baseColors.brand[10],
+ "background_surface-brand-strong-pressed": baseColors.brand[20],
+ "background_surface-brand-subtle":
+ "color-mix(in srgb, var(--mb-color-core-brand) 10%, transparent)",
+ "background_surface-brand-subtle-hover":
+ "color-mix(in srgb, var(--mb-color-core-brand), black 50%)",
+ "background_surface-brand-subtle-pressed":
+ "color-mix(in srgb, var(--mb-color-core-brand), black 75%)",
+ "background_surface-disabled": baseColors.orionAlphaInverse[10],
+ "background_surface-disabled-inverse": baseColors.orionAlpha[10],
+ "background_surface-error": baseColors.lobster[90],
+ "background_surface-error-subtle": baseColors.lobster[90],
+ "background_surface-hover":
+ "color-mix(in srgb, var(--mb-color-core-brand) 7%, transparent)",
+ "background_surface-primary": "var(--mb-color-background_page-primary)",
+ "background_surface-primary-hover": baseColors.orionAlphaInverse[20],
+ "background_surface-primary-inverse":
+ "var(--mb-color-background_page-primary-inverse)",
+ "background_surface-primary-inverse-hover": baseColors.orionAlpha[10],
+ "background_surface-primary-inverse-pressed": baseColors.orionAlpha[20],
+ "background_surface-primary-pressed": baseColors.orionAlphaInverse[10],
+ "background_surface-secondary": baseColors.orionAlphaInverse[10],
+ "background_surface-secondary-hover": baseColors.orionAlphaInverse[20],
+ "background_surface-secondary-inverse": baseColors.orionAlpha[10],
+ "background_surface-secondary-inverse-hover": baseColors.orionAlpha[20],
+ "background_surface-secondary-inverse-pressed": baseColors.orionAlpha[30],
+ "background_surface-secondary-pressed": baseColors.orionAlphaInverse[10],
+ "background_surface-selected":
+ "color-mix(in srgb, var(--mb-color-core-brand) 21%, transparent)",
+ "background_surface-success": baseColors.palm[90],
+ "background_surface-warning": baseColors.dubloon[90],
+ "background_surface-warning-strong": baseColors.dubloon[70],
+ "border-brand": baseColors.brand[80],
+ "border-filter": baseColors.filter[80],
+ "border-neutral": baseColors.orionAlphaInverse[20],
+ "border-neutral-strong": baseColors.orionAlphaInverse[30],
+ "border-neutral-strongest": baseColors.orionAlphaInverse[50],
+ "border-neutral-subtle": baseColors.orionAlphaInverse[10],
+ "core-brand-hover": baseColors.brand[30],
+ "core-gold": "#FFD700",
+ "core-info": baseColors.orion[50],
+ "core-metabase_brand": baseColors.blue[40],
+ "core-metabase_brand-hover": baseColors.blue[50],
+ "core-white": baseColors.orion[110],
+ "core-white_constant": "white",
+ "feedback-negative": baseColors.lobster[50],
+ "feedback-negative-strong": baseColors.lobster[30],
+ "feedback-neutral-strong": baseColors.orionAlphaInverse[30],
+ "feedback-positive": baseColors.palm[50],
+ "feedback-positive-selected": baseColors.palm[40],
+ "feedback-positive-strong": baseColors.palm[20],
+ "feedback-warning": baseColors.dubloon[30],
+ "feedback-warning-strong": baseColors.dubloon[20],
+ "illustration-secondary-brand": baseColors.brand[80],
+ "illustration-tertiary-brand": baseColors.brand[90],
+ "input-focus": baseColors.blue[70],
+ "modal-overlay": baseColors.orionAlpha[70],
+ "navbar-admin": baseColors.octopus[80],
+ "navbar-admin-inverse": baseColors.octopus[60],
+ "navbar-admin-secondary": baseColors.octopus[60],
+ "shadow-default": `color-mix(in srgb, ${baseColors.orion[110]} 20%, transparent)`,
+ "switch-off": baseColors.orionAlphaInverse[20],
+ "text-brand": baseColors.brand[40],
+ "text-brand-hover": baseColors.brand[30],
+ "text-brand-strong": baseColors.brand[20],
+ "text-brand-strong-hover": baseColors.brand[10],
+ "text-disabled": baseColors.orionAlphaInverse[40],
+ "text-disabled-inverse": baseColors.orionAlpha[40],
+ "text-filter": baseColors.filter[30],
+ "text-primary": baseColors.orionAlphaInverse[80],
+ "text-primary-inverse": baseColors.orionAlpha[80],
+ "text-secondary": baseColors.orionAlphaInverse[60],
+ "text-secondary-inverse": baseColors.orionAlpha[60],
+ "text-selected": baseColors.white,
+ "text-syntax-constant": baseColors.lobster[40],
+ "text-syntax-keyword": baseColors.octopus[40],
+ "text-syntax-parameter": baseColors.mango[40],
+ "text-syntax-parameter-active": baseColors.mango[90],
+ "text-syntax-string": baseColors.palm[40],
+ "text-syntax-variable": baseColors.ocean[40],
+ "text-syntax-yellow": baseColors.dubloon[30],
+ "tooltip-background": baseColors.orion[70],
+ "tooltip-background-focused": `color-mix(in srgb, ${baseColors.orion[70]} 50%, #000)`,
+ "tooltip-text": baseColors.orionAlphaInverse[80],
+ "tooltip-text-secondary": baseColors.orionAlphaInverse[60],
+};
+
/**
* The default dark theme for Metabase.
*/
@@ -12,89 +187,7 @@ export const METABASE_DARK_THEME: MetabaseThemeV2 = {
version: 2,
chartColors: DARK_THEME_ACCENT_COLORS,
colors: {
- "admin-navbar": baseColors.octopus[80],
- "admin-navbar-secondary": baseColors.octopus[60],
- "admin-navbar-inverse": baseColors.octopus[60],
- "background-brand": baseColors.brand[90],
- "background-filter": baseColors.filter[90],
- "background-disabled": baseColors.orionAlphaInverse[10],
- "background-disabled-inverse": baseColors.orionAlpha[10],
- "background-error-secondary": baseColors.lobster[90],
- "background-highlight":
- "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
- "background-hover":
- "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
- "background-selected":
- "color-mix(in srgb, var(--mb-color-brand) 21%, transparent)",
- "background-primary": baseColors.orion[100],
- "background-secondary": baseColors.orion[110],
- "background-tertiary": baseColors.orion[80],
- "background-primary-inverse": baseColors.orion[20],
- "background-secondary-inverse": baseColors.orion[30],
- "background-tertiary-inverse": baseColors.orion[70],
- overlay: baseColors.orionAlpha[70],
- "background-error": baseColors.lobster[90],
- "background-success": baseColors.palm[90],
- "background-success-secondary": baseColors.palm[70],
- brand: baseColors.blue[40],
- "brand-hover": baseColors.brand[30],
- danger: baseColors.lobster[50],
- error: baseColors.lobster[50],
- filter: baseColors.octopus[40],
- focus: baseColors.blue[70],
- "icon-brand": baseColors.brand[40],
- "icon-primary": baseColors.orionAlphaInverse[80],
- "icon-disabled": baseColors.orionAlphaInverse[30],
- "icon-secondary": baseColors.orionAlphaInverse[50],
- "illustration-brand-secondary": baseColors.brand[80],
- "illustration-brand-tertiary": baseColors.brand[90],
- "metabase-brand": baseColors.blue[40],
- "metabase-brand-hover": baseColors.blue[50],
- "saturated-blue": baseColors.ocean[40],
- "saturated-green": baseColors.palm[40],
- "saturated-purple": baseColors.octopus[40],
- "saturated-red": baseColors.lobster[40],
- "saturated-yellow": baseColors.dubloon[30],
- shadow: `color-mix(in srgb, ${baseColors.orion[110]} 20%, transparent)`,
- "success-secondary": baseColors.palm[40],
- success: baseColors.palm[50],
- summarize: baseColors.palm[40],
- "switch-off": baseColors.orionAlphaInverse[20],
- "syntax-parameters-active": baseColors.mango[90],
- "syntax-parameters": baseColors.mango[40],
- "text-brand": baseColors.brand[40],
- "text-filter": baseColors.filter[30],
- "text-tertiary": baseColors.orionAlphaInverse[40],
- "text-tertiary-inverse": baseColors.orionAlpha[40],
- "text-hover": baseColors.brand[30],
- "text-secondary-opaque": baseColors.orion[20],
- "text-primary": baseColors.orionAlphaInverse[80],
- "text-primary-inverse": baseColors.orionAlpha[80],
- "text-secondary": baseColors.orionAlphaInverse[60],
- "text-secondary-inverse": baseColors.orionAlpha[60],
- "text-selected": baseColors.white,
- "tooltip-background-focused": `color-mix(in srgb, ${baseColors.orion[70]} 50%, #000)`,
- "tooltip-background": baseColors.orion[70],
- "tooltip-text-secondary": baseColors.orionAlphaInverse[60],
- "tooltip-text": baseColors.orionAlphaInverse[80],
- warning: baseColors.dubloon[30],
- "background-warning": baseColors.dubloon[90],
- "background-warning-secondary": baseColors.dubloon[70],
- info: baseColors.orion[50],
- "background-info": baseColors.orion[90],
- white: baseColors.orion[110],
- border: baseColors.orionAlphaInverse[20],
- "border-brand": baseColors.brand[80],
- "border-filter": baseColors.filter[80],
- "border-strong": baseColors.orionAlphaInverse[30],
- "border-stronger": baseColors.orionAlphaInverse[50],
- "border-subtle": baseColors.orionAlphaInverse[10],
- copper: "#B87333",
- bronze: "#CD7F32",
- silver: "#C0C0C0",
- gold: "#FFD700",
- "upsell-primary": baseColors.ocean[30],
- "upsell-secondary": baseColors.ocean[80],
- "upsell-gem": "#00d4ff",
+ ...deprecatedColors,
+ ...actualColors,
},
};
diff --git a/frontend/src/metabase/ui/colors/constants/themes/light.ts b/frontend/src/metabase/ui/colors/constants/themes/light.ts
index 01a6bf89260..7e776a20c95 100644
--- a/frontend/src/metabase/ui/colors/constants/themes/light.ts
+++ b/frontend/src/metabase/ui/colors/constants/themes/light.ts
@@ -5,6 +5,182 @@ import { getBaseColorsForThemeDefinitionOnly } from "../base-colors";
const baseColors = getBaseColorsForThemeDefinitionOnly();
+// To be removed once the rename in GDGT-2517 is complete. Prefer the keys in
+// `actualColors` below.
+const deprecatedColors = {
+ "admin-navbar": baseColors.octopus[60],
+ "admin-navbar-secondary": baseColors.octopus[40],
+ "admin-navbar-inverse": baseColors.octopus[80],
+ "background-brand": baseColors.brand[10],
+ "background-filter": baseColors.filter[5],
+ "background-disabled": baseColors.orionAlpha[10],
+ "background-disabled-inverse": baseColors.orionAlphaInverse[10],
+ "background-error-secondary": baseColors.lobster[5],
+ "background-highlight":
+ "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
+ "background-hover":
+ "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
+ "background-selected":
+ "color-mix(in srgb, var(--mb-color-brand) 21%, transparent)",
+ "background-primary": baseColors.white,
+ "background-secondary": baseColors.orion[5],
+ "background-tertiary": baseColors.orion[10],
+ "background-primary-inverse": baseColors.orion[80],
+ "background-secondary-inverse": baseColors.orion[70],
+ "background-tertiary-inverse": baseColors.orion[40],
+ overlay: baseColors.orionAlpha[60],
+ "background-error": baseColors.lobster[10],
+ "background-success": baseColors.palm[5],
+ "background-success-secondary": baseColors.palm[20],
+ brand: baseColors.blue[40],
+ "brand-hover": baseColors.brand[50],
+ danger: baseColors.lobster[50],
+ error: baseColors.lobster[50],
+ filter: baseColors.octopus[50],
+ focus: baseColors.blue[20],
+ "icon-brand": baseColors.brand[40],
+ "icon-primary": baseColors.orionAlpha[80],
+ "icon-disabled": baseColors.orionAlpha[30],
+ "icon-secondary": baseColors.orionAlpha[50],
+ "illustration-brand-secondary": baseColors.brand[10],
+ "illustration-brand-tertiary": baseColors.brand[5],
+ "metabase-brand": baseColors.blue[40],
+ "metabase-brand-hover": baseColors.blue[30],
+ "saturated-blue": baseColors.ocean[60],
+ "saturated-green": baseColors.palm[60],
+ "saturated-purple": baseColors.octopus[60],
+ "saturated-red": baseColors.lobster[60],
+ "saturated-yellow": baseColors.dubloon[30],
+ shadow: baseColors.orionAlpha[20],
+ "success-secondary": baseColors.palm[60],
+ success: baseColors.palm[50],
+ summarize: baseColors.palm[50],
+ "syntax-parameters-active": baseColors.mango[10],
+ "syntax-parameters": baseColors.mango[60],
+ "text-tertiary": baseColors.orionAlpha[40],
+ "text-tertiary-inverse": baseColors.orionAlphaInverse[40],
+ "text-hover": baseColors.brand[60],
+ "text-secondary-opaque": baseColors.orion[60],
+ warning: baseColors.dubloon[30],
+ "background-warning": baseColors.dubloon[5],
+ "background-warning-secondary": baseColors.dubloon[20],
+ info: baseColors.orion[40],
+ "background-info": baseColors.orion[10],
+ white: baseColors.white,
+ border: baseColors.orion[20],
+ "border-strong": baseColors.orionAlpha[30],
+ "border-stronger": baseColors.orionAlpha[50],
+ "border-subtle": baseColors.orionAlpha[10],
+ copper: "#B87333",
+ bronze: "#CD7F32",
+ silver: "#C0C0C0",
+ gold: "#FFD700",
+ "upsell-primary": baseColors.ocean[70],
+ "upsell-secondary": baseColors.ocean[20],
+ "upsell-gem": "#00d4ff",
+};
+
+const actualColors = {
+ "background_page-filter": baseColors.filter[5],
+ "background_page-highlighted":
+ "color-mix(in srgb, var(--mb-color-core-brand) 7%, transparent)",
+ "background_page-primary": baseColors.white,
+ "background_page-primary-inverse": baseColors.orion[80],
+ "background_page-secondary": baseColors.orion[5],
+ "background_page-secondary-inverse": `color-mix(in srgb, ${baseColors.orion[100]}, black 25%)`,
+ "background_page-tertiary": baseColors.orion[10],
+ "background_page-tertiary-inverse": `color-mix(in srgb, ${baseColors.orion[100]}, black 50%)`,
+ "background_surface-brand-strong": baseColors.brand[60],
+ "background_surface-brand-strong-hover": baseColors.brand[70],
+ "background_surface-brand-strong-pressed": baseColors.brand[80],
+ "background_surface-brand-subtle":
+ "color-mix(in srgb, var(--mb-color-core-brand) 10%, transparent)",
+ "background_surface-brand-subtle-hover":
+ "color-mix(in srgb, var(--mb-color-core-brand) 30%, transparent)",
+ "background_surface-brand-subtle-pressed":
+ "color-mix(in srgb, var(--mb-color-core-brand) 60%, transparent)",
+ "background_surface-disabled": baseColors.orionAlpha[10],
+ "background_surface-disabled-inverse": baseColors.orionAlphaInverse[10],
+ "background_surface-error": baseColors.lobster[10],
+ "background_surface-error-subtle": baseColors.lobster[5],
+ "background_surface-hover":
+ "color-mix(in srgb, var(--mb-color-core-brand) 7%, transparent)",
+ "background_surface-primary": "var(--mb-color-background_page-primary)",
+ "background_surface-primary-hover": baseColors.orionAlpha[10],
+ "background_surface-primary-inverse":
+ "var(--mb-color-background_page-primary-inverse)",
+ "background_surface-primary-inverse-hover": baseColors.orionAlphaInverse[20],
+ "background_surface-primary-inverse-pressed":
+ baseColors.orionAlphaInverse[10],
+ "background_surface-primary-pressed": baseColors.orionAlpha[20],
+ "background_surface-secondary": baseColors.orionAlpha[10],
+ "background_surface-secondary-hover": baseColors.orionAlpha[20],
+ "background_surface-secondary-inverse": baseColors.orionAlphaInverse[10],
+ "background_surface-secondary-inverse-hover":
+ baseColors.orionAlphaInverse[20],
+ "background_surface-secondary-inverse-pressed":
+ baseColors.orionAlphaInverse[10],
+ "background_surface-secondary-pressed": baseColors.orionAlpha[30],
+ "background_surface-selected":
+ "color-mix(in srgb, var(--mb-color-core-brand) 21%, transparent)",
+ "background_surface-success": baseColors.palm[5],
+ "background_surface-warning": baseColors.dubloon[5],
+ "background_surface-warning-strong": baseColors.dubloon[20],
+ "border-brand": baseColors.brand[10],
+ "border-filter": baseColors.filter[20],
+ "border-neutral": baseColors.orion[20],
+ "border-neutral-strong": baseColors.orionAlpha[30],
+ "border-neutral-strongest": baseColors.orionAlpha[50],
+ "border-neutral-subtle": baseColors.orionAlpha[10],
+ "core-brand-hover": baseColors.brand[50],
+ "core-gold": "#FFD700",
+ "core-info": baseColors.orion[40],
+ "core-metabase_brand": baseColors.blue[40],
+ "core-metabase_brand-hover": baseColors.blue[30],
+ "core-white": baseColors.white,
+ "core-white_constant": "white",
+ "feedback-negative": baseColors.lobster[50],
+ "feedback-negative-strong": baseColors.lobster[60],
+ "feedback-neutral-strong": baseColors.orionAlpha[60],
+ "feedback-positive": baseColors.palm[50],
+ "feedback-positive-selected": baseColors.palm[60],
+ "feedback-positive-strong": baseColors.palm[60],
+ "feedback-warning": baseColors.dubloon[30],
+ "feedback-warning-strong": baseColors.mango[60],
+ "illustration-secondary-brand": baseColors.brand[10],
+ "illustration-tertiary-brand": baseColors.brand[5],
+ "input-focus": baseColors.blue[20],
+ "modal-overlay": baseColors.orionAlpha[60],
+ "navbar-admin": baseColors.octopus[60],
+ "navbar-admin-inverse": baseColors.octopus[80],
+ "navbar-admin-secondary": baseColors.octopus[40],
+ "shadow-default": baseColors.orionAlpha[20],
+ "switch-off": baseColors.orionAlpha[20],
+ "text-brand": baseColors.brand[50],
+ "text-brand-hover": baseColors.brand[60],
+ "text-brand-strong": baseColors.brand[60],
+ "text-brand-strong-hover": baseColors.brand[70],
+ "text-disabled": baseColors.orionAlpha[40],
+ "text-disabled-inverse": baseColors.orionAlphaInverse[40],
+ "text-filter": baseColors.filter[50],
+ "text-primary": baseColors.orionAlpha[80],
+ "text-primary-inverse": baseColors.orionAlphaInverse[80],
+ "text-secondary": baseColors.orionAlpha[60],
+ "text-secondary-inverse": baseColors.orionAlphaInverse[60],
+ "text-selected": baseColors.orionAlpha[80],
+ "text-syntax-constant": baseColors.lobster[60],
+ "text-syntax-keyword": baseColors.octopus[60],
+ "text-syntax-parameter": baseColors.mango[60],
+ "text-syntax-parameter-active": baseColors.mango[10],
+ "text-syntax-string": baseColors.palm[60],
+ "text-syntax-variable": baseColors.ocean[60],
+ "text-syntax-yellow": baseColors.dubloon[30],
+ "tooltip-background": baseColors.orion[80],
+ "tooltip-background-focused": `color-mix(in srgb, ${baseColors.orion[80]} 50%, #000)`,
+ "tooltip-text": baseColors.white,
+ "tooltip-text-secondary": baseColors.orionAlphaInverse[60],
+};
+
/**
* The default light theme for Metabase.
*/
@@ -12,89 +188,7 @@ export const METABASE_LIGHT_THEME: MetabaseThemeV2 = {
version: 2,
chartColors: LIGHT_THEME_ACCENT_COLORS,
colors: {
- "admin-navbar": baseColors.octopus[60],
- "admin-navbar-secondary": baseColors.octopus[40],
- "admin-navbar-inverse": baseColors.octopus[80],
- "background-brand": baseColors.brand[10],
- "background-filter": baseColors.filter[5],
- "background-disabled": baseColors.orionAlpha[10],
- "background-disabled-inverse": baseColors.orionAlphaInverse[10],
- "background-error-secondary": baseColors.lobster[5],
- "background-highlight":
- "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
- "background-hover":
- "color-mix(in srgb, var(--mb-color-brand) 7%, transparent)",
- "background-selected":
- "color-mix(in srgb, var(--mb-color-brand) 21%, transparent)",
- "background-primary": baseColors.white,
- "background-secondary": baseColors.orion[5],
- "background-tertiary": baseColors.orion[10],
- "background-primary-inverse": baseColors.orion[80],
- "background-secondary-inverse": baseColors.orion[70],
- "background-tertiary-inverse": baseColors.orion[40],
- overlay: baseColors.orionAlpha[60],
- "background-error": baseColors.lobster[10],
- "background-success": baseColors.palm[5],
- "background-success-secondary": baseColors.palm[20],
- brand: baseColors.blue[40],
- "brand-hover": baseColors.brand[50],
- danger: baseColors.lobster[50],
- error: baseColors.lobster[50],
- filter: baseColors.octopus[50],
- focus: baseColors.blue[20],
- "icon-brand": baseColors.brand[40],
- "icon-primary": baseColors.orionAlpha[80],
- "icon-disabled": baseColors.orionAlpha[30],
- "icon-secondary": baseColors.orionAlpha[50],
- "illustration-brand-secondary": baseColors.brand[10],
- "illustration-brand-tertiary": baseColors.brand[5],
- "metabase-brand": baseColors.blue[40],
- "metabase-brand-hover": baseColors.blue[30],
- "saturated-blue": baseColors.ocean[60],
- "saturated-green": baseColors.palm[60],
- "saturated-purple": baseColors.octopus[60],
- "saturated-red": baseColors.lobster[60],
- "saturated-yellow": baseColors.dubloon[30],
- shadow: baseColors.orionAlpha[20],
- "success-secondary": baseColors.palm[60],
- success: baseColors.palm[50],
- summarize: baseColors.palm[50],
- "switch-off": baseColors.orionAlpha[20],
- "syntax-parameters-active": baseColors.mango[10],
- "syntax-parameters": baseColors.mango[60],
- "text-brand": baseColors.brand[50],
- "text-filter": baseColors.filter[50],
- "text-tertiary": baseColors.orionAlpha[40],
- "text-tertiary-inverse": baseColors.orionAlphaInverse[40],
- "text-hover": baseColors.brand[60],
- "text-secondary-opaque": baseColors.orion[60],
- "text-primary": baseColors.orionAlpha[80],
- "text-primary-inverse": baseColors.orionAlphaInverse[80],
- "text-secondary": baseColors.orionAlpha[60],
- "text-secondary-inverse": baseColors.orionAlphaInverse[60],
- "text-selected": baseColors.orionAlpha[80],
- "tooltip-background-focused": `color-mix(in srgb, ${baseColors.orion[80]} 50%, #000)`,
- "tooltip-background": baseColors.orion[80],
- "tooltip-text-secondary": baseColors.orionAlphaInverse[60],
- "tooltip-text": baseColors.white,
- warning: baseColors.dubloon[30],
- "background-warning": baseColors.dubloon[5],
- "background-warning-secondary": baseColors.dubloon[20],
- info: baseColors.orion[40],
- "background-info": baseColors.orion[10],
- white: baseColors.white,
- border: baseColors.orion[20],
- "border-brand": baseColors.brand[10],
- "border-strong": baseColors.orionAlpha[30],
- "border-stronger": baseColors.orionAlpha[50],
- "border-subtle": baseColors.orionAlpha[10],
- "border-filter": baseColors.filter[20],
- copper: "#B87333",
- bronze: "#CD7F32",
- silver: "#C0C0C0",
- gold: "#FFD700",
- "upsell-primary": baseColors.ocean[70],
- "upsell-secondary": baseColors.ocean[20],
- "upsell-gem": "#00d4ff",
+ ...deprecatedColors,
+ ...actualColors,
},
};
diff --git a/frontend/src/metabase/ui/colors/derive-theme.ts b/frontend/src/metabase/ui/colors/derive-theme.ts
index 3eaeafcb729..fe68e2d46f6 100644
--- a/frontend/src/metabase/ui/colors/derive-theme.ts
+++ b/frontend/src/metabase/ui/colors/derive-theme.ts
@@ -39,14 +39,24 @@ export function deriveFullMetabaseTheme({
...PROTECTED_COLORS,
);
- return {
- version: 2,
- colors: {
- ...baseTheme.colors,
- ...mapChartColorsToAccents(baseTheme.chartColors),
- ...deriveAllAccentColors(whitelabelColors ?? {}),
- ...filteredEmbeddingColors,
- ...mapChartColorsToAccents(embeddingThemeOverride?.chartColors ?? []),
- } as Record<MetabaseColorKey, string>,
- };
+ const colors = {
+ ...baseTheme.colors,
+ ...mapChartColorsToAccents(baseTheme.chartColors),
+ ...deriveAllAccentColors(whitelabelColors ?? {}),
+ ...filteredEmbeddingColors,
+ ...mapChartColorsToAccents(embeddingThemeOverride?.chartColors ?? []),
+ } as Record<MetabaseColorKey, string>;
+
+ // These 3 assignments are temporary compatibility layer for colors migration (GDGT-2517)
+ // Custom brand, filter, and summarize colors (whitelabelling) are passed directly from settings
+ // as part of `whitelabelColors` into `deriveAllAccentColors` which passes them through without
+ // any processing (as they aren't accent colors), and this way they get included in colors object.
+ // But brand colors might be also overriden by embedding (`filteredEmbeddingColors`). To ensure that
+ // colors available by new name (core-*) always match actual brand/filter/summarize we copy there
+ // here, after all possible overrides are done, instead of e.g. extending original `whitelabelColors`
+ colors["core-brand"] = colors.brand;
+ colors["core-filter"] = colors.filter;
+ colors["core-summarize"] = colors.summarize;
+
+ return { version: 2, colors };
}
diff --git a/frontend/src/metabase/ui/colors/types/color-keys.ts b/frontend/src/metabase/ui/colors/types/color-keys.ts
index 9ecc784fb9b..ebb03964d8e 100644
--- a/frontend/src/metabase/ui/colors/types/color-keys.ts
+++ b/frontend/src/metabase/ui/colors/types/color-keys.ts
@@ -14,6 +14,7 @@ import type { ALL_ACCENT_COLOR_NAMES } from "../constants/accents";
export type MetabaseColorKey =
| MetabaseAccentColorKey
| ProtectedColorKey
+ // Legacy colors. Prefer using new ones. See GDGT-2517 for details
| "background-brand"
| "background-filter"
| "background-disabled"
@@ -35,8 +36,6 @@ export type MetabaseColorKey =
| "background-warning"
| "background-warning-secondary"
| "border"
- | "border-brand"
- | "border-filter"
| "border-strong"
| "border-stronger"
| "border-subtle"
@@ -67,26 +66,102 @@ export type MetabaseColorKey =
| "success"
| "success-secondary"
| "summarize"
- | "switch-off"
| "syntax-parameters"
| "syntax-parameters-active"
+ | "text-hover"
+ | "text-secondary-opaque"
+ | "text-tertiary"
+ | "text-tertiary-inverse"
+ | "warning"
+ | "white"
+
+ // New names
+ | "background_page-filter"
+ | "background_page-highlighted"
+ | "background_page-primary"
+ | "background_page-primary-inverse"
+ | "background_page-secondary"
+ | "background_page-secondary-inverse"
+ | "background_page-tertiary"
+ | "background_page-tertiary-inverse"
+ | "background_surface-brand-strong"
+ | "background_surface-brand-strong-hover"
+ | "background_surface-brand-strong-pressed"
+ | "background_surface-brand-subtle"
+ | "background_surface-brand-subtle-hover"
+ | "background_surface-brand-subtle-pressed"
+ | "background_surface-disabled"
+ | "background_surface-disabled-inverse"
+ | "background_surface-error"
+ | "background_surface-error-subtle"
+ | "background_surface-hover"
+ | "background_surface-primary"
+ | "background_surface-primary-hover"
+ | "background_surface-primary-inverse"
+ | "background_surface-primary-inverse-hover"
+ | "background_surface-primary-inverse-pressed"
+ | "background_surface-primary-pressed"
+ | "background_surface-secondary"
+ | "background_surface-secondary-hover"
+ | "background_surface-secondary-inverse"
+ | "background_surface-secondary-inverse-hover"
+ | "background_surface-secondary-inverse-pressed"
+ | "background_surface-secondary-pressed"
+ | "background_surface-selected"
+ | "background_surface-success"
+ | "background_surface-warning"
+ | "background_surface-warning-strong"
+ | "border-brand"
+ | "border-filter"
+ | "border-neutral"
+ | "border-neutral-strong"
+ | "border-neutral-strongest"
+ | "border-neutral-subtle"
+ | "core-brand"
+ | "core-brand-hover"
+ | "core-filter"
+ | "core-gold"
+ | "core-info"
+ | "core-summarize"
+ | "core-white"
+ | "core-white_constant"
+ | "feedback-negative"
+ | "feedback-negative-strong"
+ | "feedback-neutral-strong"
+ | "feedback-positive"
+ | "feedback-positive-selected"
+ | "feedback-positive-strong"
+ | "feedback-warning"
+ | "feedback-warning-strong"
+ | "illustration-secondary-brand"
+ | "illustration-tertiary-brand"
+ | "input-focus"
+ | "modal-overlay"
+ | "shadow-default"
+ | "switch-off"
| "text-brand"
+ | "text-brand-hover"
+ | "text-brand-strong"
+ | "text-brand-strong-hover"
+ | "text-disabled"
+ | "text-disabled-inverse"
| "text-filter"
- | "text-hover"
| "text-primary"
| "text-primary-inverse"
| "text-secondary"
| "text-secondary-inverse"
- | "text-secondary-opaque"
| "text-selected"
- | "text-tertiary"
- | "text-tertiary-inverse"
+ | "text-syntax-constant"
+ | "text-syntax-keyword"
+ | "text-syntax-parameter"
+ | "text-syntax-parameter-active"
+ | "text-syntax-string"
+ | "text-syntax-variable"
+ | "text-syntax-yellow"
| "tooltip-background"
| "tooltip-background-focused"
| "tooltip-text"
- | "tooltip-text-secondary"
- | "warning"
- | "white";
+ | "tooltip-text-secondary";
/**
* @inline
@@ -99,6 +174,7 @@ export type MetabaseAccentColorKey = (typeof ALL_ACCENT_COLOR_NAMES)[number];
* Do not derive this from `PROTECTED_COLORS` or doc generation will fail.
*/
export type ProtectedColorKey =
+ // Legacy names
| "metabase-brand"
| "metabase-brand-hover"
| "admin-navbar"
@@ -107,6 +183,12 @@ export type ProtectedColorKey =
| "upsell-primary"
| "upsell-secondary"
| "upsell-gem"
+ // New names
+ | "core-metabase_brand"
+ | "core-metabase_brand-hover"
+ | "navbar-admin"
+ | "navbar-admin-secondary"
+ | "navbar-admin-inverse"
| "accent0"
| "accent1"
| "accent2"
diff --git a/frontend/src/metabase/ui/colors/types/theme.ts b/frontend/src/metabase/ui/colors/types/theme.ts
index 9ba7d599144..c4e872bc63e 100644
--- a/frontend/src/metabase/ui/colors/types/theme.ts
+++ b/frontend/src/metabase/ui/colors/types/theme.ts
@@ -9,7 +9,7 @@ import type { MetabaseAccentColorKey, MetabaseColorKey } from "./color-keys";
export interface MetabaseThemeV2 {
version: 2;
- colors: Record<MetabaseColorKeyWithoutAccents, string>;
+ colors: Record<MetabaseRequiredThemeColorKey, string>;
chartColors: ChartColorV2[];
}
@@ -43,11 +43,19 @@ export type ChartColorV2 =
}
| null;
+/** Filled in by `deriveFullMetabaseTheme`; not required from theme files. */
+export const DERIVED_COLOR_KEYS = [
+ "core-brand",
+ "core-filter",
+ "core-summarize",
+] as const;
+type DerivedColorKey = (typeof DERIVED_COLOR_KEYS)[number];
+
/**
- * Metabase color keys without accent0 - accent7.
- * Those will be transformed from `chartColors`.
+ * Metabase color keys without colors that are automatically derived.
+ * Accents are transformed from `chartColors`, DerivedColorKey are derived in `deriveFullMetabaseTheme`
*/
-type MetabaseColorKeyWithoutAccents = Exclude<
+type MetabaseRequiredThemeColorKey = Exclude<
MetabaseColorKey,
- MetabaseAccentColorKey
+ MetabaseAccentColorKey | DerivedColorKey
>;