mistercrunch commented on code in PR #35220: URL: https://github.com/apache/superset/pull/35220#discussion_r2371306175
########## superset-frontend/packages/superset-ui-core/src/theme/Theme.tsx: ########## @@ -118,9 +53,48 @@ export class Theme { * If simple tokens are provided as { token: {...} }, they will be applied with defaults * If no config is provided, uses default tokens * Dark mode can be set via the algorithm property in the config + * @param config - The theme configuration + * @param baseTheme - Optional base theme to apply under the config */ - static fromConfig(config?: AnyThemeConfig): Theme { - return new Theme({ config }); + static fromConfig( + config?: AnyThemeConfig, + baseTheme?: AnyThemeConfig, + ): Theme { + let mergedConfig: AnyThemeConfig | undefined = config; + + if (baseTheme && config) { + mergedConfig = { + ...baseTheme, + ...config, + } as AnyThemeConfig; + + if (baseTheme.token || config.token) { + (mergedConfig as any).token = { + ...(baseTheme.token || {}), + ...(config.token || {}), + }; + } + + if (baseTheme.components || config.components) { Review Comment: didn't look deep into the logic, but is this whole section a use case for `lodash`'s merge function? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org