From 61922f28ee703d858081a21efd02775139c5f549 Mon Sep 17 00:00:00 2001 From: Carter Date: Mon, 18 Nov 2024 15:47:07 -0600 Subject: [PATCH] hard coded the background colors in theme to keep them consistent between light and dark modes --- src/app/App.tsx | 3 ++- src/app/Header.tsx | 10 +++++++--- src/navigation/SideNavigator.tsx | 8 +++++--- src/theme/theme.ts | 34 +++++++++++++++++++++++++------- 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index cc174a8..6daa51a 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -5,7 +5,7 @@ import HTTPProvider from 'providers/http' import { useState } from 'react' import LoadingScreen from './LoadingScreen' import UserWrapper from './UserWrapper' -import { Theme, ThemeProvider } from '@mui/material' +import { CssBaseline, Theme, ThemeProvider } from '@mui/material' import { CreateTheme } from '../theme/theme' import { getThemeType, setThemeType } from '../theme/themeType' @@ -40,6 +40,7 @@ function App() { cacheLocation='localstorage' > + { token ? diff --git a/src/app/Header.tsx b/src/app/Header.tsx index f381033..2d5ef86 100644 --- a/src/app/Header.tsx +++ b/src/app/Header.tsx @@ -22,10 +22,11 @@ const useStyles = makeStyles((theme: Theme) => ({ marginRight: theme.spacing(0.5), [theme.breakpoints.up("md")]: { marginRight: theme.spacing(1.5) - } + }, + color: getSignatureAccentColour() + " !important" }, button: { - color: getSignatureAccentColour() + color: getSignatureAccentColour() + " !important" }, hide: { display: "none" @@ -85,6 +86,8 @@ export default function Header(props: Props) { const themeType = useThemeType(); const classes = useStyles() + console.log(getSignatureColour()) + return ( @@ -94,7 +97,8 @@ export default function Header(props: Props) { color="inherit" aria-label="Open side menu" onClick={openSide} - className={classNames(classes.button, sideIsOpen && classes.hide)}> + style={{ color: getSignatureAccentColour() }} + className={classes.button}> {/* )} */} diff --git a/src/navigation/SideNavigator.tsx b/src/navigation/SideNavigator.tsx index 659e00b..7804a50 100644 --- a/src/navigation/SideNavigator.tsx +++ b/src/navigation/SideNavigator.tsx @@ -1,4 +1,4 @@ -import { ChevronRight, People } from "@mui/icons-material"; +import { ChevronRight, People, PeopleOutline, PeopleOutlined, PeopleSharp } from "@mui/icons-material"; import ChevronLeft from "@mui/icons-material/ChevronLeft"; import { darken, Divider, Grid2 as Grid, IconButton, lighten, List, ListItemButton, ListItemIcon, ListItemText, SwipeableDrawer, Theme, Toolbar, Tooltip, useTheme } from "@mui/material"; import classNames from "classnames"; @@ -6,6 +6,7 @@ import { useWidth } from "../hooks/useWidth"; import { makeStyles } from "@mui/styles"; import BindaptIcon from "../products/Bindapt/BindaptIcon"; import { Link, useLocation } from "react-router-dom"; +import { getSignatureAccentColour } from "services/whiteLabel"; const drawerWidth = 230; @@ -49,8 +50,9 @@ const useStyles = makeStyles((theme: Theme) => ({ [theme.breakpoints.up("md")]: { paddingLeft: theme.spacing(3), paddingRight: theme.spacing(3) - } - }, + }, + color: theme.palette.mode === "light" ? "white" : "black" + }, activeItem: theme.palette.mode === "light" ? { diff --git a/src/theme/theme.ts b/src/theme/theme.ts index 0e353c6..68ce4fa 100644 --- a/src/theme/theme.ts +++ b/src/theme/theme.ts @@ -11,15 +11,15 @@ export function CreateTheme(themeType: "light" | "dark"): Theme { return responsiveFontSizes(createTheme(options(themeType))); } -function generateBackgroundShades(baseColor: string, themeType: "light" | "dark") { +function generateBackgroundShades(themeType: "light" | "dark") { if(themeType==="light") return ({ - default: lighten(baseColor, 0.75), - paper: lighten(baseColor, 0.75) + default: "#f2f2f2", + paper: "#fafafa" }) return { - default: darken(baseColor, 0.50), // Lightens the base color for background.default - paper: darken(baseColor, 0.50), // Slightly less light for background.paper + default: "#303030", // Lightens the base color for background.default + paper: "#424242", // Slightly less light for background.paper }; } @@ -27,7 +27,7 @@ function options(themeType: "light" | "dark"): ThemeOptions { const signature = getSignatureColour(); const accent = getSignatureAccentColour(); - const bg = generateBackgroundShades(Colours.grey[800], themeType) + const bg = generateBackgroundShades(themeType) return { palette: { primary: Colours[getPrimaryColour() as keyof typeof Colours], @@ -197,9 +197,29 @@ function options(themeType: "light" | "dark"): ThemeOptions { color: accent, // Customize ripple color here // color: "white" }, + '&:hover': { + color: themeType === "light" ? signature : "white", // Customize ripple color here + // color: "white" + }, }, }, - } + }, + MuiCssBaseline: { + styleOverrides: { + body: { + backgroundColor: bg, // Set your desired background color + // color: '#333', // Optionally, you can also set the default text color + }, + }, + }, + MuiSvgIcon: { + styleOverrides: { + root: { + // Set the default icon color for light mode + // color: "black", // Dark color for icons in light mode + }, + }, + }, } } as ThemeOptions; }