From 5911367a18f362836e43222a4a3ba61f08b7a123 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Sun, 14 Oct 2018 14:48:39 +0300 Subject: [PATCH] Fix illegible text color in columns Size and Modified on dark theme Signed-off-by: Alexey Pyltsyn --- apps/files/js/filelist.js | 14 ++++++++++++++ lib/private/Template/JSConfigHelper.php | 1 + 2 files changed, 15 insertions(+) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 94052b10b3..d835847bec 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1384,6 +1384,10 @@ // rgb(118, 118, 118) / #767676 // min. color contrast for normal text on white background according to WCAG AA sizeColor = Math.round(118-Math.pow((fileData.size/(1024*1024)),2)); + + if (oc_defaults.themeName === 'themedark') { + sizeColor = Math.abs(sizeColor); + } } else { simpleSize = t('files', 'Pending'); } @@ -1403,6 +1407,16 @@ if (modifiedColor >= '118') { modifiedColor = 118; } + if (oc_defaults.themeName === 'themedark') { + modifiedColor = Math.abs(modifiedColor); + + // ensure that the dimmest color is still readable + // rgb(130, 130, 130) / #828282 + // min. color contrast for normal text on black background according to WCAG AA + if (modifiedColor < 130) { + modifiedColor = 130; + } + } var formatted; var text; if (mtime > 0) { diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index b691a8a64c..c0dbe3a07f 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -260,6 +260,7 @@ class JSConfigHelper { 'shortFooter' => $this->defaults->getShortFooter(), 'longFooter' => $this->defaults->getLongFooter(), 'folder' => \OC_Util::getTheme(), + 'themeName' => $this->config->getUserValue($uid, 'accessibility', 'theme', false), ]), "oc_capabilities" => json_encode($capabilities), ];