feat(style):调整滚动条样式。
This commit is contained in:
parent
78c5be1bb1
commit
6c38137a8d
38
src/theme.ts
38
src/theme.ts
@ -2,16 +2,18 @@ import { MantineTheme } from '@mantine/core';
|
|||||||
import { useColorScheme } from '@mantine/hooks';
|
import { useColorScheme } from '@mantine/hooks';
|
||||||
import { ifElse, path, propEq } from 'ramda';
|
import { ifElse, path, propEq } from 'ramda';
|
||||||
|
|
||||||
const bgColorSelectFn = ifElse(
|
const bgColorSelectFn = (lightIndex: number, darkIndex: number) =>
|
||||||
propEq('colorScheme', 'light'),
|
ifElse(
|
||||||
path(['colors', 'cbg', 8]),
|
propEq('colorScheme', 'light'),
|
||||||
path(['colors', 'cbg', 0])
|
path(['colors', 'cbg', lightIndex]),
|
||||||
);
|
path(['colors', 'cbg', darkIndex])
|
||||||
const fgColorSelectFn = ifElse(
|
);
|
||||||
propEq('colorScheme', 'light'),
|
const fgColorSelectFn = (lightIndex: number, darkIndex: number) =>
|
||||||
path(['colors', 'cfg', 0]),
|
ifElse(
|
||||||
path(['colors', 'cfg', 8])
|
propEq('colorScheme', 'light'),
|
||||||
);
|
path(['colors', 'cfg', lightIndex]),
|
||||||
|
path(['colors', 'cfg', darkIndex])
|
||||||
|
);
|
||||||
|
|
||||||
export function useAppTheme(): Partial<MantineTheme> {
|
export function useAppTheme(): Partial<MantineTheme> {
|
||||||
const colorScheme = useColorScheme();
|
const colorScheme = useColorScheme();
|
||||||
@ -50,11 +52,23 @@ export function useAppTheme(): Partial<MantineTheme> {
|
|||||||
globalStyles: theme => ({
|
globalStyles: theme => ({
|
||||||
'html, body': {
|
'html, body': {
|
||||||
height: '100vh',
|
height: '100vh',
|
||||||
color: fgColorSelectFn(theme),
|
color: fgColorSelectFn(0, 8)(theme),
|
||||||
backgroundColor: bgColorSelectFn(theme)
|
backgroundColor: bgColorSelectFn(8, 0)(theme)
|
||||||
},
|
},
|
||||||
'#root': {
|
'#root': {
|
||||||
height: '100%'
|
height: '100%'
|
||||||
|
},
|
||||||
|
'::-webkit-scrollbar': {
|
||||||
|
width: 4,
|
||||||
|
backgroundColor: bgColorSelectFn(6, 2)(theme)
|
||||||
|
},
|
||||||
|
'::-webkit-scrollbar-track': {
|
||||||
|
borderRadius: 2,
|
||||||
|
backgroundColor: 'transparent'
|
||||||
|
},
|
||||||
|
'::-webkit-scrollbar-thumb': {
|
||||||
|
borderRadius: 2,
|
||||||
|
backgroundColor: bgColorSelectFn(4, 4)(theme)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user