UNPKG

893 BJavaScriptView Raw
1import { alpha, getPath } from '@mui/system';
2export var colorTransformations = {
3 primary: 'primary.main',
4 textPrimary: 'text.primary',
5 secondary: 'secondary.main',
6 textSecondary: 'text.secondary',
7 error: 'error.main'
8};
9
10var transformDeprecatedColors = function transformDeprecatedColors(color) {
11 return colorTransformations[color] || color;
12};
13
14var getTextDecoration = function getTextDecoration(_ref) {
15 var theme = _ref.theme,
16 ownerState = _ref.ownerState;
17 var transformedColor = transformDeprecatedColors(ownerState.color);
18 var color = getPath(theme, "palette.".concat(transformedColor), false) || ownerState.color;
19 var channelColor = getPath(theme, "palette.".concat(transformedColor, "Channel"));
20
21 if ('vars' in theme && channelColor) {
22 return "rgba(".concat(channelColor, " / 0.4)");
23 }
24
25 return alpha(color, 0.4);
26};
27
28export default getTextDecoration;
\No newline at end of file