11.11. Loading a custom Developer Hub theme by using a dynamic plugin
You can load a custom Developer Hub theme from a dynamic plugin.
Procedure
Export a theme provider function in your dynamic plugin, for example:
Sample
myTheme.tsfragmentimport { lightTheme } from './lightTheme'; // some custom theme import { UnifiedThemeProvider } from '@backstage/theme'; export const lightThemeProvider = ({ children }: { children: ReactNode }) => ( <UnifiedThemeProvider theme={lightTheme} children={children} /> );For more information about creating a custom theme, see Backstage documentation - Creating a Custom Theme.
Configure Developer Hub to load the theme in the UI by using the
themesconfiguration field:app-config.yamlfragmentdynamicPlugins: frontend: example.my-custom-theme-plugin: themes: - id: light title: Light variant: light icon: someIconReference importName: lightThemeProviderid-
Set your theme ID by specifying the desired value. Optionally, override the default Developer Hub themes by using the following ID values:
lightto replace the default light theme, ordarkto replace the default dark theme.
Verification
- The theme is available in the Developer Hub Settings page.