UNPKG

@activelylearn/material-ui

Version:

Material-UI's workspace package

55 lines (47 loc) 1.46 kB
// @flow import deepmerge from 'deepmerge'; // < 1kb payload overhead when lodash/merge is > 3kb. import warning from 'warning'; import createTypography from './createTypography'; import createBreakpoints from './createBreakpoints'; import createPalette from './createPalette'; import createMixins from './createMixins'; import shadows from './shadows'; import transitions from './transitions'; import zIndex from './zIndex'; import spacing from './spacing'; function createMuiTheme(options: Object = {}) { const { palette: paletteInput = {}, breakpoints: breakpointsInput = {}, mixins: mixinsInput = {}, typography: typographyInput = {}, shadows: shadowsInput, ...other } = options; const palette = createPalette(paletteInput); const breakpoints = createBreakpoints(breakpointsInput); const muiTheme = { breakpoints, direction: 'ltr', mixins: createMixins(breakpoints, spacing, mixinsInput), overrides: {}, // Inject custom styles palette, props: {}, // Inject custom properties shadows: shadowsInput || shadows, typography: createTypography(palette, typographyInput), ...deepmerge( { transitions, spacing, zIndex, }, other, ), }; warning( muiTheme.shadows.length === 25, 'Material-UI: the shadows array provided to createMuiTheme should support 25 elevations.', ); return muiTheme; } export default createMuiTheme;