From 67ec02d1a9514513c2b5881dba7c8cae6c386ae7 Mon Sep 17 00:00:00 2001 From: Samora Mabuya Date: Wed, 22 Jun 2022 15:20:16 +0200 Subject: [PATCH] [Alert] Use getContrastText for filled variant font color (#29813) --- packages/mui-material/src/Alert/Alert.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/mui-material/src/Alert/Alert.js b/packages/mui-material/src/Alert/Alert.js index 3d1195f9305e24..4242c175e14e75 100644 --- a/packages/mui-material/src/Alert/Alert.js +++ b/packages/mui-material/src/Alert/Alert.js @@ -70,7 +70,9 @@ const AlertRoot = styled(Paper, { }), ...(color && ownerState.variant === 'filled' && { - color: '#fff', + color: theme.palette.getContrastText( + theme.palette.mode === 'dark' ? theme.palette[color].dark : theme.palette[color].main, + ), fontWeight: theme.typography.fontWeightMedium, backgroundColor: theme.palette.mode === 'dark' ? theme.palette[color].dark : theme.palette[color].main,