Spinning from comment thread in #20651.
We should look at how to support a self-explanatory API for consumers to create a custom theme.
We could do that by modifying the signature of mergeThemes to allow for this type of functionality:
export function mergeThemes<TTheme extends Theme = Theme, TPartialTheme extends PartialTheme = PartialTheme>(a: TTheme | undefined, b: TPartialTheme | undefined): TTheme & TPartialTheme {
...
}
And then we could do:
import { mergeThemes, webLightTheme } from '@fluentui/react-theme';
const customTokens = {...};
const customTheme = mergeTheme(webLightTheme, customTokens);
// easily accessible shape inferred from source of truth - actual implementation
type CustomTheme = typeof customTheme;
Spinning from comment thread in #20651.
We should look at how to support a self-explanatory API for consumers to create a custom theme.
We could do that by modifying the signature of
mergeThemesto allow for this type of functionality:And then we could do: