@fluentui/react-theme-provider
Version:
Fluent UI React theme provider component, hook, and theme related utilities.
19 lines • 624 B
JavaScript
import { useContext } from 'react';
import { useCustomizationSettings } from '@uifabric/utilities';
import { createTheme } from '@fluentui/theme';
import { ThemeContext } from './ThemeContext';
/**
* Get theme from CustomizerContext or Customizations singleton.
*/
function useCompatTheme() {
return useCustomizationSettings(['theme']).theme;
}
/**
* React hook for programmatically accessing the theme.
*/
export var useTheme = function () {
var theme = useContext(ThemeContext);
var legacyTheme = useCompatTheme();
return theme || legacyTheme || createTheme({});
};
//# sourceMappingURL=useTheme.js.map