You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/theme/ThemeProvider.tsx
+22-1Lines changed: 22 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,9 @@ import { augmentColor } from './themeMaterialUtil'
24
24
25
25
exportinterfaceThemeProviderProps{
26
26
/**
27
-
* To override the font families used. default is used for Typography,
27
+
* Should either return a `theme.FontOptions` object to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
28
+
*
29
+
* default is used for Typography,
28
30
* text for Text, display for Display and mono for Monospace.
* Should either return a [set of material-ui color intentions](https://material-ui.com/customization/palette/#customization) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
46
+
*
47
+
* The material-ui colors can be specified: palette.primary, palette.secondary, palette.error, palette.warning, palette.info or palette.success
48
+
*
49
+
* Additionally the committed-theme colors can be specified: palette.brand, palette.neutral
50
+
*/
42
51
createPaletteOptions?: ()=>PaletteOptions
52
+
/**
53
+
* Should either return material-ui shape options i.e. `{ borderRadius: xx }` to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
54
+
*/
43
55
createShape?: ()=>ShapeOptions|undefined
56
+
/**
57
+
* Should either return [material-ui spacing options](https://material-ui.com/customization/spacing/) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
58
+
*/
44
59
createSpacing?: ()=>SpacingOptions|undefined
60
+
/**
61
+
* Should either return [material-ui typography options](https://material-ui.com/customization/typography/) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
62
+
*/
45
63
createTypography?: ()=>
46
64
|TypographyOptions
47
65
|((palette: Palette)=>TypographyOptions)
48
66
|undefined
67
+
/**
68
+
* Should either return [material-ui overrides options](https://material-ui.com/customization/globals/) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults. It is passed the palette created using the `createPaletteOptions()` prop
@@ -40,17 +40,30 @@ but others can be used if necessary.
40
40
</ThemeProvider>
41
41
```
42
42
43
+
## Custom Fonts
44
+
45
+
The optional `createFonts()` prop should either return a `theme.FontOptions` object to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
46
+
43
47
Custom font stacks can be provided for different typography components. You may need to separately load your font, using imports, links or css; see [example](https://github.com/commitd/components/tree/master/example).
44
48
We recommend using [typefaces](https://github.com/KyleAMathews/typefaces)
@@ -63,20 +76,267 @@ We recommend using [typefaces](https://github.com/KyleAMathews/typefaces)
63
76
</Story>
64
77
</Preview>
65
78
66
-
Custom palette colours can be specified. For example, the primary, secondary or brand colors. Either variants of each shade must be specified, or a [material-ui color preset](https://material-ui.com/customization/color/#color) should be used.
79
+
## Custom Colours
80
+
81
+
Custom palette colours can be specified. For example, the primary, secondary or brand colors.
82
+
83
+
The optional `createPalette()` prop should either return a [set of material-ui color intentions](https://material-ui.com/customization/palette/#customization) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
84
+
85
+
The material-ui colors can be specified: palette.primary, palette.secondary, palette.error, palette.warning, palette.info or palette.success
86
+
87
+
Additionally the committed-theme colors can be specified: palette.brand, palette.neutral
The optional `createShape()` prop should either return material-ui shape options i.e. `{ borderRadius: xx }` to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
An Example of custom theming, with blue and yellow colours:
143
+
## Custom Spacing
144
+
145
+
Override the meaning of spacing props. These are dimensionless values given to things like margin and padding. All Material components will be affected, so Use with care.
146
+
147
+
The optional `createSpacing()` prop should either return [material-ui spacing options](https://material-ui.com/customization/spacing/) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
The optional `createTypography()` prop should either return [material-ui typography options](https://material-ui.com/customization/typography/) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults.
Text. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
264
+
Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore
265
+
consectetur.
266
+
</C.Text>
267
+
<C.Monospacewrap>
268
+
Monospace. Lorem ipsum dolor sit amet, consectetur adipisicing
269
+
elit. Quos blanditiis tenetur unde suscipit, quam beatae rerum
270
+
inventore consectetur.
271
+
</C.Monospace>
272
+
</C.Box>
273
+
</C.Flex>
274
+
</Background>
275
+
</C.ThemeProvider>
276
+
</Story>
277
+
</Preview>
278
+
279
+
## Custom Global CSS Overrides
280
+
281
+
The optional `createOverrides()` prop should either return [material-ui overrides options](https://material-ui.com/customization/globals/) to replace the Committed theme defaults, or it should return undefined to use the Material-UI defaults. It is passed the palette created using the `createPaletteOptions()` prop
0 commit comments