Add highcontrast class to body just like with dark theme

Signed-off-by: Jan C. Borchardt <hey@jancborchardt.net>
This commit is contained in:
Jan C. Borchardt 2020-08-11 16:22:43 +02:00 committed by John Molakvoæ (skjnldsv)
parent 9809b77221
commit aa16550670
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
6 changed files with 17 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -90,14 +90,18 @@ export default {
// SELECT handlers
selectHighContrast(id) {
this.selectItem('highcontrast', id)
document.body.classList.toggle('theme--highcontrast')
},
selectTheme(id) {
const previous = this.selected.theme
if (previous) {
document.body.classList.remove(previous)
document.body.classList.remove(`theme--${previous}`)
}
if (id) {
document.body.classList.add(id)
document.body.classList.remove('theme--light')
document.body.classList.add(`theme--${id}`)
} else {
document.body.classList.add('theme--light')
}
this.selectItem('theme', id)

View File

@ -23,5 +23,11 @@ import { loadState } from '@nextcloud/initial-state'
OCA.Accessibility = loadState('accessibility', 'data')
if (OCA.Accessibility.theme !== false) {
document.body.classList.add(OCA.Accessibility.theme)
document.body.classList.add(`theme--${OCA.Accessibility.theme}`)
} else {
document.body.classList.add('theme--light')
}
if (OCA.Accessibility.highcontrast !== false) {
document.body.classList.add('theme--highcontrast')
}