Merge pull request #19109 from nextcloud/bugfix/18528/dark-theme-last-modified

Adjust filelist color handling to new dark theme value
This commit is contained in:
Roeland Jago Douma 2020-01-24 13:10:56 +01:00 committed by GitHub
commit 2168e0ad89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -1591,6 +1591,8 @@
td.append(linkElem); td.append(linkElem);
tr.append(td); tr.append(td);
var isDarkTheme = OCA.Accessibility && OCA.Accessibility.theme === 'dark'
try { try {
var maxContrastHex = window.getComputedStyle(document.documentElement) var maxContrastHex = window.getComputedStyle(document.documentElement)
.getPropertyValue('--color-text-maxcontrast').trim() .getPropertyValue('--color-text-maxcontrast').trim()
@ -1599,10 +1601,7 @@
} }
var maxContrast = parseInt(maxContrastHex.substring(1, 3), 16) var maxContrast = parseInt(maxContrastHex.substring(1, 3), 16)
} catch(error) { } catch(error) {
var maxContrast = OCA.Accessibility var maxContrast = isDarkTheme ? 130 : 118
&& OCA.Accessibility.theme === 'themedark'
? 130
: 118
} }
// size column // size column
@ -1618,7 +1617,7 @@
sizeColor = maxContrast; sizeColor = maxContrast;
} }
if (OCA.Accessibility && OCA.Accessibility.theme === 'themedark') { if (isDarkTheme) {
sizeColor = Math.abs(sizeColor); sizeColor = Math.abs(sizeColor);
// ensure that the dimmest color is still readable // ensure that the dimmest color is still readable
// min. color contrast for normal text on black background according to WCAG AA // min. color contrast for normal text on black background according to WCAG AA
@ -1646,7 +1645,7 @@
modifiedColor = maxContrast; modifiedColor = maxContrast;
} }
if (OCA.Accessibility && OCA.Accessibility.theme === 'themedark') { if (isDarkTheme) {
modifiedColor = Math.abs(modifiedColor); modifiedColor = Math.abs(modifiedColor);
// ensure that the dimmest color is still readable // ensure that the dimmest color is still readable