Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions web-common/src/features/themes/theme-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,9 @@ class ThemeManager {
: themeSpec.light;

// Handle legacy theme format (colors: primary/secondary)
// Fall back to legacy color fields only in light mode
// TODO: ENG-957
const primaryColor =
modeTheme?.primary ||
(!isThemeModeDark ? themeSpec.primaryColorRaw : undefined);
const secondaryColor =
modeTheme?.secondary ||
(!isThemeModeDark ? themeSpec.secondaryColorRaw : undefined);
// Fall back to legacy color fields in both light and dark modes
const primaryColor = modeTheme?.primary || themeSpec.primaryColorRaw;
const secondaryColor = modeTheme?.secondary || themeSpec.secondaryColorRaw;

return {
primary: primaryColor ? getChroma(primaryColor) : primary[`500`],
Expand All @@ -164,10 +159,7 @@ class ThemeManager {

// Handle legacy theme format (colors: primary/secondary)
// If neither light nor dark is defined, create a theme object from legacy fields
// but only for light mode
// TODO: ENG-957
const hasLegacyColors =
!isThemeModeDark &&
!themeSpec.light &&
!themeSpec.dark &&
(themeSpec.primaryColorRaw || themeSpec.secondaryColorRaw);
Expand Down
5 changes: 3 additions & 2 deletions web-common/src/features/themes/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class Theme {
private processTheme(spec: V1ThemeSpec) {
// Handle legacy theme format (colors: primary/secondary)
// If neither light nor dark is defined, but we have legacy color fields,
// treat them as light mode colors only for backwards compatibility
// generate both light and dark palettes from them
const hasLegacyColors =
!spec.light &&
!spec.dark &&
Expand All @@ -120,7 +120,8 @@ export class Theme {
secondary: spec.secondaryColorRaw,
};
const lightColors = this.processColors(legacyColors);
return { dark: {}, light: lightColors };
const darkColors = this.processColors(legacyColors, true);
return { dark: darkColors, light: lightColors };
}

const darkColors = this.processColors(spec.dark ?? {}, true);
Expand Down
Loading