Change scrollbar styling

This commit is contained in:
schroda
2024-05-20 16:28:36 +02:00
parent 37a371863f
commit b207639445

View File

@@ -6,7 +6,14 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/ */
import { createTheme as createMuiTheme, Direction, Palette as MuiPalette, Theme } from '@mui/material/styles'; import {
createTheme as createMuiTheme,
darken,
Direction,
lighten,
Palette as MuiPalette,
Theme,
} from '@mui/material/styles';
declare module '@mui/material/styles/createPalette' { declare module '@mui/material/styles/createPalette' {
interface Palette { interface Palette {
@@ -48,13 +55,16 @@ export const createTheme = (dark?: boolean, direction: Direction = 'ltr') => {
MuiCssBaseline: { MuiCssBaseline: {
styleOverrides: ` styleOverrides: `
*::-webkit-scrollbar { *::-webkit-scrollbar {
width: 10px; width: 14px;
background: ${dark ? '#222' : '#e1e1e1'};
} }
*::-webkit-scrollbar-thumb { *::-webkit-scrollbar-thumb {
background: ${dark ? '#111' : '#aaa'}; border: 4px solid rgba(0, 0, 0, 0);
border-radius: 5px; background-clip: padding-box;
border-radius: 9999px;
background-color: ${dark ? lighten(baseTheme.palette.background.default, 0.4) : darken(baseTheme.palette.background.default, 0.4)};
}
*::-webkit-scrollbar-thumb:hover {
border-width: 2px;
} }
`, `,
}, },