Skip to content

Commit

Permalink
[docs] Fix two tone icon dark mode color (mui#39868)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored Nov 14, 2023
1 parent e049e1b commit 7173292
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
17 changes: 16 additions & 1 deletion docs/data/material/components/icons/TwoToneIcons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import * as React from 'react';
import { useTheme } from '@mui/material/styles';
import Icon from '@mui/material/Icon';

const useIsDarkMode = () => {
const theme = useTheme();
return theme.palette.mode === 'dark';
};

export default function TwoToneIcons() {
return <Icon baseClassName="material-icons-two-tone">add_circle</Icon>;
const isDarkMode = useIsDarkMode();

return (
<Icon
sx={{ ...(isDarkMode && { filter: 'invert(1)' }) }}
baseClassName="material-icons-two-tone"
>
add_circle
</Icon>
);
}
17 changes: 16 additions & 1 deletion docs/data/material/components/icons/TwoToneIcons.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import * as React from 'react';
import { useTheme } from '@mui/material/styles';
import Icon from '@mui/material/Icon';

const useIsDarkMode = () => {
const theme = useTheme();
return theme.palette.mode === 'dark';
};

export default function TwoToneIcons() {
return <Icon baseClassName="material-icons-two-tone">add_circle</Icon>;
const isDarkMode = useIsDarkMode();

return (
<Icon
sx={{ ...(isDarkMode && { filter: 'invert(1)' }) }}
baseClassName="material-icons-two-tone"
>
add_circle
</Icon>
);
}
7 changes: 6 additions & 1 deletion docs/data/material/components/icons/TwoToneIcons.tsx.preview
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<Icon baseClassName="material-icons-two-tone">add_circle</Icon>
<Icon
sx={{ ...(isDarkMode && { filter: 'invert(1)' }) }}
baseClassName="material-icons-two-tone"
>
add_circle
</Icon>

0 comments on commit 7173292

Please sign in to comment.