Merge pull request #14142 from rakleed/dark-scrollbar

Make dark scrollbar in dark theme
This commit is contained in:
tidy-dev 2022-03-15 07:38:42 -04:00 committed by GitHub
commit bf54e40e5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,9 +63,17 @@ export class AppTheme extends React.PureComponent<IAppThemeProps> {
) {
this.clearThemes()
body.classList.add(newThemeClassName)
this.updateColorScheme()
}
}
private updateColorScheme = () => {
const isDarkTheme = document.body.classList.contains('theme-dark')
const rootStyle = document.documentElement.style
rootStyle.colorScheme = isDarkTheme ? 'dark' : 'light'
}
/**
* This takes a custom theme object and applies it over top either our dark or
* light theme dynamically creating a new variables style sheet.
@ -102,6 +110,7 @@ export class AppTheme extends React.PureComponent<IAppThemeProps> {
styles.appendChild(document.createTextNode(customThemeStyles))
body.appendChild(styles)
this.updateColorScheme()
}
private clearThemes() {