Permalink
material-ui/packages/material-ui/src/styles/createMuiTheme.js
Newer
100644
60 lines (54 sloc)
1.64 KB
1
import deepmerge from 'deepmerge'; // < 1kb payload overhead when lodash/merge is > 3kb.
2
import isPlainObject from 'is-plain-object';
4
import createBreakpoints from './createBreakpoints';
5
import createMixins from './createMixins';
6
import createPalette from './createPalette';
7
import createTypography from './createTypography';
10
import defaultSpacing from './spacing';
11
import transitions from './transitions';
15
const {
16
breakpoints: breakpointsInput = {},
17
mixins: mixinsInput = {},
20
spacing: spacingInput = {},
22
...other
23
} = options;
24
25
const palette = createPalette(paletteInput);
26
const breakpoints = createBreakpoints(breakpointsInput);
27
const spacing = { ...defaultSpacing, ...spacingInput };
32
mixins: createMixins(breakpoints, spacing, mixinsInput),
33
overrides: {}, // Inject custom styles
34
palette,
35
props: {}, // Inject custom properties
36
shadows: shadowsInput || shadows,
37
typography: createTypography(palette, typographyInput),
46
{
47
isMergeableObject: isPlainObject,
48
},
51
52
warning(
53
muiTheme.shadows.length === 25,
54
'Material-UI: the shadows array provided to createMuiTheme should support 25 elevations.',
55
);
56
57
return muiTheme;