Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(dynamic-branding): custom palette colors not applied to semantic tokens (#17252)

Avram Tudor04dc27b9e887
diff --git a/react/features/base/ui/utils.ts b/react/features/base/ui/utils.ts
index 0e8e469577..54373d421f 100644
--- a/react/features/base/ui/utils.ts
+++ b/react/features/base/ui/utils.ts
@@ -2,15 +2,20 @@ import { merge } from 'lodash-es';
import * as jitsiTokens from './jitsiTokens.json';
import * as tokens from './tokens.json';
+import { IPalette } from './types';
/**
* Creates the color tokens based on the color theme and the association map.
*
* @param {Object} colorMap - A map between the token name and the actual color value.
+ * @param {Object} customTokens - Optional custom token overrides to merge before resolution.
+ * This allows custom branding colors to propagate through semantic token references.
+ * For example, if customTokens contains { action01: '#custom' }, then any semantic token
+ * that references 'action01' (like 'prejoinActionButtonPrimary') will resolve to '#custom'.
* @returns {Object}
*/
-export function createColorTokens(colorMap: Object): any {
- const allTokens = merge({}, tokens, jitsiTokens);
+export function createColorTokens(colorMap: Object, customTokens?: Partial<IPalette>): any {
+ const allTokens = merge({}, tokens, jitsiTokens, customTokens || {});
const result: any = {};
// First pass: resolve tokens that reference allTokens directly
diff --git a/react/features/dynamic-branding/functions.web.ts b/react/features/dynamic-branding/functions.web.ts
index 338ca97509..8f5da809a8 100644
--- a/react/features/dynamic-branding/functions.web.ts
+++ b/react/features/dynamic-branding/functions.web.ts
@@ -53,8 +53,13 @@ export function createMuiBrandingTheme(customTheme: Theme) {
spacing: customSpacing
} = customTheme;
- const newPalette = createColorTokens(colorMap);
+ // Pass customPalette to createColorTokens so that custom colors are merged
+ // BEFORE token resolution. This ensures that semantic tokens (like prejoinActionButtonPrimary)
+ // that reference base tokens (like action01) will resolve to the custom color values.
+ const newPalette = createColorTokens(colorMap, customPalette);
+ // Also apply overwriteRecurrsive for any direct palette key overrides that may not be
+ // handled through token resolution (e.g., if customer provides semantic token names directly).
if (customPalette) {
overwriteRecurrsive(newPalette, customPalette);
}