-
Notifications
You must be signed in to change notification settings - Fork 60
Adjusted dark mode #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Adjusted dark mode #268
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adjusts the dark mode visuals by conditionally loading different assets and updating theme colors for improved user experience. Key changes include:
- Conditionally rendering dark mode logos in Home.tsx.
- Updating the dark mode background color in DateRange.tsx.
- Revising theme configuration and style overrides in App.tsx for dark mode support.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
File | Description |
---|---|
src/pages/Home.tsx | Adds conditional rendering to display a dark mode logo when the theme is in dark mode. |
src/components/DateRange.tsx | Changes the dark mode background color from '#1E1E1E' to '#242424'. |
src/App.tsx | Updates theme definitions and component style overrides with new dark mode color variables. |
Comments suppressed due to low confidence (1)
src/App.tsx:238
- Consider replacing 'default' with theme.palette.background.default to ensure the correct light mode background color is applied.
<Stack sx={{backgroundColor: (theme) => (theme.palette.mode === 'light' ? 'default' : darkBg2)}} marginTop="auto" p={2}>
@@ -191,13 +196,17 @@ function Dashboard({setThemeMode}: {setThemeMode: (theme: PaletteMode) => void}) | |||
</IconButton> | |||
</Toolbar> | |||
</AppBar> | |||
<Drawer variant="permanent" open={open}> | |||
<Drawer | |||
sx={{backgroundColor: (theme) => (theme.palette.mode === 'light' ? 'default' : darkBg2)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the literal 'default' for backgroundColor may not yield the intended theme background. Consider using theme.palette.background.default instead.
sx={{backgroundColor: (theme) => (theme.palette.mode === 'light' ? 'default' : darkBg2)}} | |
sx={{backgroundColor: (theme) => (theme.palette.mode === 'light' ? theme.palette.background.default : darkBg2)}} |
Copilot uses AI. Check for mistakes.
<List sx={{backgroundColor: (theme) => (theme.palette.mode === 'light' ? 'default' : darkBg2)}} component="nav"> | ||
<NavItems open={open} /> | ||
</List> | ||
<Stack marginTop="auto" p={2}> | ||
<Stack | ||
sx={{backgroundColor: (theme) => (theme.palette.mode === 'light' ? 'default' : darkBg2)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'default' as a background color may not render as expected. Replace it with theme.palette.background.default for consistency.
Copilot uses AI. Check for mistakes.
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiButton: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiSvgIcon: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiDrawer: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg2, | ||
}, | ||
}, | ||
}, | ||
MuiDialog: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the literal 'default' for a color may not have the intended effect. Consider referencing theme.palette.text.primary or a similar valid color value.
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg3, | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg3, |
Copilot uses AI. Check for mistakes.
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiButton: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiSvgIcon: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiDrawer: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg2, | ||
}, | ||
}, | ||
}, | ||
MuiDialog: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'default' as a color value might not render properly; consider using a valid theme color such as theme.palette.text.primary.
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg3, | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg3, |
Copilot uses AI. Check for mistakes.
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiButton: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiSvgIcon: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiDrawer: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg2, | ||
}, | ||
}, | ||
}, | ||
MuiDialog: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the 'default' literal with theme.palette.text.primary (or an appropriate theme color) to ensure consistent text styling in light mode.
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg3, | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.text.primary : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg3, |
Copilot uses AI. Check for mistakes.
backgroundColor: mode === 'light' ? 'default' : darkBg2, | ||
}, | ||
}, | ||
}, | ||
MuiDialog: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use theme.palette.background.default instead of 'default' to correctly apply the light mode background color.
backgroundColor: mode === 'light' ? 'default' : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg3, | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg3, |
Copilot uses AI. Check for mistakes.
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiButton: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiSvgIcon: { | ||
styleOverrides: { | ||
root: { | ||
color: mode === 'light' ? 'default' : darkModeText, | ||
}, | ||
}, | ||
}, | ||
MuiDrawer: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg2, | ||
}, | ||
}, | ||
}, | ||
MuiDialog: { | ||
styleOverrides: { | ||
paper: { | ||
backgroundColor: mode === 'light' ? 'default' : darkBg3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 'default' with theme.palette.background.default to ensure proper rendering of the light mode dialog background.
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? 'default' : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? 'default' : darkBg3, | |
color: mode === 'light' ? theme.palette.background.default : darkModeText, | |
}, | |
}, | |
}, | |
MuiButton: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.background.default : darkModeText, | |
}, | |
}, | |
}, | |
MuiSvgIcon: { | |
styleOverrides: { | |
root: { | |
color: mode === 'light' ? theme.palette.background.default : darkModeText, | |
}, | |
}, | |
}, | |
MuiDrawer: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg2, | |
}, | |
}, | |
}, | |
MuiDialog: { | |
styleOverrides: { | |
paper: { | |
backgroundColor: mode === 'light' ? theme.palette.background.default : darkBg3, |
Copilot uses AI. Check for mistakes.
@@ -116,7 +116,7 @@ function ButtonField(props: ButtonFieldProps) { | |||
color: theme.palette.text.secondary, | |||
position: 'absolute', | |||
// HACK: Match dark mode MUI Paper at elevation 1, which is where this is currently used | |||
backgroundColor: theme.palette.mode === 'light' ? theme.palette.background.default : '#1E1E1E', | |||
backgroundColor: theme.palette.mode === 'light' ? theme.palette.background.default : '#242424', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the hard-coded dark mode color '#242424' into a theme constant to maintain consistency across components.
Copilot uses AI. Check for mistakes.
Before:

After:

Light mode remains unchanged