Update mui theme
This commit is contained in:
@@ -200,7 +200,7 @@ const DescriptionGenre = ({
|
|||||||
position: isCollapsed ? 'absolute' : null,
|
position: isCollapsed ? 'absolute' : null,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
background: (theme) => `linear-gradient(transparent 1px, ${theme.palette.background.paper})`,
|
background: (theme) => `linear-gradient(transparent 1px, ${theme.palette.background.default})`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton sx={{ color: (theme) => (theme.palette.mode === 'light' ? 'black' : 'text') }}>
|
<IconButton sx={{ color: (theme) => (theme.palette.mode === 'light' ? 'black' : 'text') }}>
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export function DefaultNavBar() {
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton color="inherit" aria-label="open drawer" onClick={() => setIsCollapsed(false)}>
|
<IconButton aria-label="open drawer" onClick={() => setIsCollapsed(false)}>
|
||||||
<MenuIcon />
|
<MenuIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -157,7 +157,6 @@ export function DefaultNavBar() {
|
|||||||
component="button"
|
component="button"
|
||||||
sx={{ marginRight: 2 }}
|
sx={{ marginRight: 2 }}
|
||||||
size="large"
|
size="large"
|
||||||
color="inherit"
|
|
||||||
aria-label="menu"
|
aria-label="menu"
|
||||||
onClick={handleBack}
|
onClick={handleBack}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -58,7 +58,14 @@ const NavigationBarItem = ({ path, title, IconComponent, SelectedIconComponent }
|
|||||||
<Tooltip title={t(title)} placement="right">
|
<Tooltip title={t(title)} placement="right">
|
||||||
<ListItem sx={listItemProps}>
|
<ListItem sx={listItemProps}>
|
||||||
<ListItemIcon sx={listItemIconProps}>
|
<ListItemIcon sx={listItemIconProps}>
|
||||||
<Icon sx={{ color: isActive ? 'primary.main' : undefined }} />
|
<Icon
|
||||||
|
sx={{
|
||||||
|
color: isActive ? 'primary.dark' : undefined,
|
||||||
|
...theme.applyStyles('dark', {
|
||||||
|
color: isActive ? 'primary.light' : undefined,
|
||||||
|
}),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={t(title)}
|
primary={t(title)}
|
||||||
@@ -69,7 +76,10 @@ const NavigationBarItem = ({ path, title, IconComponent, SelectedIconComponent }
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
...(isCollapsed ? theme.typography.caption : {}),
|
...(isCollapsed ? theme.typography.caption : {}),
|
||||||
color: isActive ? 'primary.main' : undefined,
|
color: isActive ? 'primary.dark' : undefined,
|
||||||
|
...theme.applyStyles('dark', {
|
||||||
|
color: isActive ? 'primary.light' : undefined,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export const MobileBottomBar = ({ navBarItems }: { navBarItems: NavbarItem[] })
|
|||||||
elevation={3}
|
elevation={3}
|
||||||
>
|
>
|
||||||
<BottomNavigation
|
<BottomNavigation
|
||||||
sx={{ backgroundColor: 'custom.light' }}
|
|
||||||
showLabels
|
showLabels
|
||||||
value={selectedNavBarItem}
|
value={selectedNavBarItem}
|
||||||
onChange={(_, newValue: string) => {
|
onChange={(_, newValue: string) => {
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ export const TrackerActiveCard = ({
|
|||||||
<Card sx={CARD_STYLING}>
|
<Card sx={CARD_STYLING}>
|
||||||
<CardContent sx={{ padding: 0 }}>
|
<CardContent sx={{ padding: 0 }}>
|
||||||
<TrackerActiveHeader trackRecord={trackRecord} tracker={tracker} openSearch={onClick} />
|
<TrackerActiveHeader trackRecord={trackRecord} tracker={tracker} openSearch={onClick} />
|
||||||
<Card>
|
<Card sx={{ backgroundColor: 'background.default' }}>
|
||||||
<CardContent sx={{ padding: '0' }}>
|
<CardContent sx={{ padding: '0' }}>
|
||||||
<Box sx={{ padding: 1 }}>
|
<Box sx={{ padding: 1 }}>
|
||||||
<TrackerActiveCardInfoRow>
|
<TrackerActiveCardInfoRow>
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ export const TrackerMangaCard = ({
|
|||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
sx={{
|
sx={{
|
||||||
|
backgroundColor: 'background.default',
|
||||||
marginBottom: 2,
|
marginBottom: 2,
|
||||||
'&:last-child': { marginBottom: 8 },
|
'&:last-child': { marginBottom: 8 },
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ export const TrackerSearch = ({
|
|||||||
<Button
|
<Button
|
||||||
disabled={bindTrackerMutation.loading}
|
disabled={bindTrackerMutation.loading}
|
||||||
size="large"
|
size="large"
|
||||||
color="primary"
|
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={trackManga}
|
onClick={trackManga}
|
||||||
sx={{ width: '75%' }}
|
sx={{ width: '75%' }}
|
||||||
|
|||||||
@@ -44,23 +44,17 @@ const HeightPreservingItem = ({ children, ...props }: BoxProps) => (
|
|||||||
const DownloadChapterItem = ({
|
const DownloadChapterItem = ({
|
||||||
provided,
|
provided,
|
||||||
item,
|
item,
|
||||||
isDragging,
|
|
||||||
handleDelete,
|
handleDelete,
|
||||||
}: {
|
}: {
|
||||||
provided: DraggableProvided;
|
provided: DraggableProvided;
|
||||||
item: ChapterDownloadStatus;
|
item: ChapterDownloadStatus;
|
||||||
isDragging: boolean;
|
|
||||||
handleDelete: (chapter: ChapterIdInfo) => void;
|
handleDelete: (chapter: ChapterIdInfo) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef} sx={{ p: 1, pb: 0 }}>
|
<Box {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef} sx={{ p: 1, pb: 0 }}>
|
||||||
<Card
|
<Card>
|
||||||
sx={{
|
|
||||||
backgroundColor: isDragging ? 'custom.light' : undefined,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CardActionArea component={Link} to={`/manga/${item.manga.id}`}>
|
<CardActionArea component={Link} to={`/manga/${item.manga.id}`}>
|
||||||
<CardContent
|
<CardContent
|
||||||
sx={{
|
sx={{
|
||||||
@@ -253,7 +247,6 @@ export const DownloadQueue: React.FC = () => {
|
|||||||
<DownloadChapterItem
|
<DownloadChapterItem
|
||||||
provided={provided}
|
provided={provided}
|
||||||
item={queue[rubric.source.index]}
|
item={queue[rubric.source.index]}
|
||||||
isDragging={snapshot.isDragging}
|
|
||||||
handleDelete={handleDelete}
|
handleDelete={handleDelete}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -277,7 +270,6 @@ export const DownloadQueue: React.FC = () => {
|
|||||||
<DownloadChapterItem
|
<DownloadChapterItem
|
||||||
provided={draggableProvided}
|
provided={draggableProvided}
|
||||||
item={item}
|
item={item}
|
||||||
isDragging={false}
|
|
||||||
handleDelete={handleDelete}
|
handleDelete={handleDelete}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
65
src/theme.ts
65
src/theme.ts
@@ -11,44 +11,55 @@ import {
|
|||||||
darken,
|
darken,
|
||||||
Direction,
|
Direction,
|
||||||
lighten,
|
lighten,
|
||||||
Palette as MuiPalette,
|
Palette,
|
||||||
responsiveFontSizes,
|
responsiveFontSizes,
|
||||||
Theme,
|
Theme,
|
||||||
} from '@mui/material/styles';
|
} from '@mui/material/styles';
|
||||||
|
|
||||||
declare module '@mui/material/styles/createPalette' {
|
|
||||||
interface Palette {
|
|
||||||
custom: Palette['primary'];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PaletteOptions {
|
|
||||||
custom: PaletteOptions['primary'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const SCROLLBAR_WIDTH = 14;
|
export const SCROLLBAR_WIDTH = 14;
|
||||||
|
|
||||||
type DefaultMuiPalette = Omit<MuiPalette, 'custom'>;
|
|
||||||
type DefaultMuiTheme = Omit<Theme, 'palette'> & { palette: DefaultMuiPalette };
|
|
||||||
|
|
||||||
let theme: Theme;
|
let theme: Theme;
|
||||||
export const getCurrentTheme = () => theme;
|
export const getCurrentTheme = () => theme;
|
||||||
export const createTheme = (dark?: boolean, direction: Direction = 'ltr') => {
|
export const createTheme = (
|
||||||
const baseTheme: DefaultMuiTheme = createMuiTheme({
|
dark?: boolean,
|
||||||
|
direction: Direction = 'ltr',
|
||||||
|
color: string = '#5b74ef',
|
||||||
|
pureBlackMode: boolean = false,
|
||||||
|
) => {
|
||||||
|
const isDarkMode = dark || pureBlackMode;
|
||||||
|
|
||||||
|
const baseTheme = createMuiTheme({
|
||||||
direction,
|
direction,
|
||||||
palette: {
|
palette: {
|
||||||
mode: dark ? 'dark' : 'light',
|
mode: isDarkMode ? 'dark' : 'light',
|
||||||
|
primary: {
|
||||||
|
main: color,
|
||||||
},
|
},
|
||||||
} as Theme);
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const suwayomiTheme = createMuiTheme(
|
const backgroundTrueBlack: Palette['background'] = {
|
||||||
{
|
paper: '#111',
|
||||||
|
default: '#000',
|
||||||
|
};
|
||||||
|
const backgroundDark: Palette['background'] = {
|
||||||
|
paper: darken(baseTheme.palette.primary.main, 0.75),
|
||||||
|
default: darken(baseTheme.palette.primary.main, 0.85),
|
||||||
|
};
|
||||||
|
const backgroundLight: Palette['background'] = {
|
||||||
|
paper: lighten(baseTheme.palette.primary.dark, 0.75),
|
||||||
|
default: lighten(baseTheme.palette.primary.dark, 0.85),
|
||||||
|
};
|
||||||
|
const backgroundThemeMode = isDarkMode ? backgroundDark : backgroundLight;
|
||||||
|
const background = pureBlackMode ? backgroundTrueBlack : backgroundThemeMode;
|
||||||
|
|
||||||
|
const colorTheme = createMuiTheme(baseTheme, {
|
||||||
palette: {
|
palette: {
|
||||||
custom: {
|
background,
|
||||||
main: dark ? baseTheme.palette.common.black : baseTheme.palette.common.white,
|
|
||||||
light: dark ? baseTheme.palette.grey[900] : baseTheme.palette.grey[100],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const suwayomiTheme = createMuiTheme(colorTheme, {
|
||||||
components: {
|
components: {
|
||||||
MuiUseMediaQuery: {
|
MuiUseMediaQuery: {
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
@@ -64,7 +75,7 @@ export const createTheme = (dark?: boolean, direction: Direction = 'ltr') => {
|
|||||||
border: 4px solid rgba(0, 0, 0, 0);
|
border: 4px solid rgba(0, 0, 0, 0);
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
background-color: ${dark ? lighten(baseTheme.palette.background.default, 0.4) : darken(baseTheme.palette.background.default, 0.4)};
|
background-color: ${colorTheme.palette.primary[isDarkMode ? 'dark' : 'light']};
|
||||||
}
|
}
|
||||||
*::-webkit-scrollbar-thumb:hover {
|
*::-webkit-scrollbar-thumb:hover {
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
@@ -72,9 +83,7 @@ export const createTheme = (dark?: boolean, direction: Direction = 'ltr') => {
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
baseTheme,
|
|
||||||
);
|
|
||||||
|
|
||||||
theme = responsiveFontSizes(suwayomiTheme);
|
theme = responsiveFontSizes(suwayomiTheme);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user