aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-12-14 17:57:45 +0100
committerEduardo Morales <emoral435@gmail.com>2023-12-18 10:25:10 -0600
commit2e5d435df70020672542c2955cb616fd111dd3bb (patch)
tree535613c232283f8137a51df9d42bf9169a7cca76 /apps
parentf225bf97dd1fc7085b33faea32ec1b3806ea9863 (diff)
downloadnextcloud-server-2e5d435df70020672542c2955cb616fd111dd3bb.tar.gz
nextcloud-server-2e5d435df70020672542c2955cb616fd111dd3bb.zip
fix(theming): Adjust status colors to be also accessible on blurry background
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/css/default.css18
-rw-r--r--apps/theming/lib/Themes/DefaultTheme.php12
-rw-r--r--apps/theming/tests/Themes/AccessibleThemeTestCase.php37
3 files changed, 51 insertions, 16 deletions
diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css
index e9388e6ab60..19d874e5a8e 100644
--- a/apps/theming/css/default.css
+++ b/apps/theming/css/default.css
@@ -21,17 +21,17 @@
/** @deprecated use `--color-text-maxcontrast` instead */
--color-text-lighter: var(--color-text-maxcontrast);
--color-scrollbar: rgba(34,34,34, .15);
- --color-error: #d91812;
- --color-error-rgb: 217,24,18;
- --color-error-hover: #dd342f;
- --color-error-text: #c61610;
- --color-warning: #b88100;
- --color-warning-rgb: 184,129,0;
- --color-warning-hover: #c69a32;
- --color-warning-text: #855d00;
+ --color-error: #C00505;
+ --color-error-rgb: 192,5,5;
+ --color-error-hover: #c72424;
+ --color-error-text: #C00505;
+ --color-warning: #A37200;
+ --color-warning-rgb: 163,114,0;
+ --color-warning-hover: #8a6000;
+ --color-warning-text: #7f5900;
--color-success: #2d7b41;
--color-success-rgb: 45,123,65;
- --color-success-hover: #448955;
+ --color-success-hover: #428854;
--color-success-text: #286c39;
--color-info: #0071ad;
--color-info-rgb: 0,113,173;
diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php
index e215ade7b6d..599c5ed58a9 100644
--- a/apps/theming/lib/Themes/DefaultTheme.php
+++ b/apps/theming/lib/Themes/DefaultTheme.php
@@ -111,8 +111,8 @@ class DefaultTheme implements ITheme {
$colorBoxShadow = $this->util->darken($colorMainBackground, 70);
$colorBoxShadowRGB = join(',', $this->util->hexToRGB($colorBoxShadow));
- $colorError = '#d91812';
- $colorWarning = '#b88100';
+ $colorError = '#C00505';
+ $colorWarning = '#A37200';
$colorSuccess = '#2d7b41';
$colorInfo = '#0071ad';
@@ -148,14 +148,14 @@ class DefaultTheme implements ITheme {
'--color-error' => $colorError,
'--color-error-rgb' => join(',', $this->util->hexToRGB($colorError)),
'--color-error-hover' => $this->util->mix($colorError, $colorMainBackground, 75),
- '--color-error-text' => $this->util->darken($colorError, 4),
+ '--color-error-text' => $colorError,
'--color-warning' => $colorWarning,
'--color-warning-rgb' => join(',', $this->util->hexToRGB($colorWarning)),
- '--color-warning-hover' => $this->util->mix($colorWarning, $colorMainBackground, 60),
- '--color-warning-text' => $this->util->darken($colorWarning, 10),
+ '--color-warning-hover' => $this->util->darken($colorWarning, 5),
+ '--color-warning-text' => $this->util->darken($colorWarning, 7),
'--color-success' => $colorSuccess,
'--color-success-rgb' => join(',', $this->util->hexToRGB($colorSuccess)),
- '--color-success-hover' => $this->util->mix($colorSuccess, $colorMainBackground, 78),
+ '--color-success-hover' => $this->util->mix($colorSuccess, $colorMainBackground, 80),
'--color-success-text' => $this->util->darken($colorSuccess, 4),
'--color-info' => $colorInfo,
'--color-info-rgb' => join(',', $this->util->hexToRGB($colorInfo)),
diff --git a/apps/theming/tests/Themes/AccessibleThemeTestCase.php b/apps/theming/tests/Themes/AccessibleThemeTestCase.php
index 29ad8cfaff2..fbd0722552d 100644
--- a/apps/theming/tests/Themes/AccessibleThemeTestCase.php
+++ b/apps/theming/tests/Themes/AccessibleThemeTestCase.php
@@ -46,6 +46,26 @@ class AccessibleThemeTestCase extends TestCase {
],
3.0,
],
+ 'status color elements on background' => [
+ [
+ '--color-error',
+ '--color-error-hover',
+ '--color-warning',
+ '--color-warning-hover',
+ '--color-info',
+ '--color-info-hover',
+ '--color-success',
+ '--color-success-hover',
+ ],
+ [
+ '--color-main-background',
+ '--color-background-hover',
+ '--color-background-dark',
+ '--color-background-darker',
+ '--color-main-background-blur',
+ ],
+ 3.0,
+ ],
'primary-element-text' => [
[
'--color-primary-element-text',
@@ -92,6 +112,21 @@ class AccessibleThemeTestCase extends TestCase {
],
4.5,
],
+ 'status-text' => [
+ [
+ '--color-error-text',
+ '--color-warning-text',
+ '--color-success-text',
+ '--color-info-text',
+ ],
+ [
+ '--color-main-background',
+ '--color-background-hover',
+ '--color-background-dark',
+ '--color-main-background-blur',
+ ],
+ 4.5,
+ ],
];
}
@@ -108,7 +143,7 @@ class AccessibleThemeTestCase extends TestCase {
$variables = $this->theme->getCSSVariables();
// Blur effect does not work so we mockup the color - worst supported case is the default "clouds" background image (on dark themes the clouds with white color are bad on bright themes the primary color as sky is bad)
- $variables['--color-main-background-blur'] = $this->util->mix($variables['--color-main-background'], $this->util->isBrightColor($variables['--color-main-background']) ? $variables['--color-primary'] : '#ffffff', 75);
+ $variables['--color-main-background-blur'] = $this->util->mix($variables['--color-main-background'], $this->util->isBrightColor($variables['--color-main-background']) ? '#000000' : '#ffffff', 75);
foreach ($backgroundColors as $background) {
$this->assertStringStartsWith('#', $variables[$background], 'Is not a plain color variable - consider to remove or fix this test');