@@ -14,7 +14,8 @@ const useStyles = makeStyles(theme => ({
1414 fontSize : ( { size } ) => size / 2
1515 } ,
1616 colorDefault : {
17- color : ( { color } ) => ( color ? theme . palette . primary . contrastText : '' ) ,
17+ color : ( { color, textColor } ) =>
18+ textColor ? textColor : color ? theme . palette . primary . contrastText : '' ,
1819 background : ( { color } ) =>
1920 supportedColors . includes ( color ) ? colorMapping [ color ] : color
2021 }
@@ -28,14 +29,16 @@ const Avatar = ({
2829 innerBorder,
2930 disabled,
3031 display,
32+ textColor,
3133 ...props
3234} ) => {
3335 const isCustomSize = typeof size === 'number'
3436 const defaultColor =
3537 typeof props . children === 'string' ? nameToColor ( props . children ) : undefined
3638 const classes = useStyles ( {
3739 size : isCustomSize ? size : undefined ,
38- color : color === 'none' ? undefined : color || defaultColor
40+ color : color === 'none' ? undefined : color || defaultColor ,
41+ textColor
3942 } )
4043
4144 return (
@@ -59,6 +62,7 @@ Avatar.propTypes = {
5962 PropTypes . oneOf ( [ 'xs' , 's' , 'm' , 'l' , 'xl' ] ) ,
6063 PropTypes . number
6164 ] ) ,
65+ textColor : PropTypes . string ,
6266 color : PropTypes . oneOfType ( [
6367 PropTypes . oneOf ( [ ...supportedColors , 'none' ] ) ,
6468 PropTypes . string
0 commit comments