Skip to content

Commit b183c79

Browse files
authored
Merge pull request #42887 from nextcloud/fix/accessible-border-color
fix(theming): Make sure `color-border-maxcontrast` fulfills 3:1 contrast
2 parents ef41104 + 18b91ba commit b183c79

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

apps/theming/css/default.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
--color-box-shadow: rgba(var(--color-box-shadow-rgb), 0.5);
4444
--color-border: #ededed;
4545
--color-border-dark: #dbdbdb;
46-
--color-border-maxcontrast: #949494;
46+
--color-border-maxcontrast: #7d7d7d;
4747
--font-face: system-ui, -apple-system, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
4848
--default-font-size: 15px;
4949
--animation-quick: 100ms;

apps/theming/lib/Themes/DarkHighContrastTheme.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public function getCSSVariables(): array {
118118

119119
'--color-border' => $this->util->lighten($colorMainBackground, 50),
120120
'--color-border-dark' => $this->util->lighten($colorMainBackground, 50),
121+
'--color-border-maxcontrast' => $this->util->lighten($colorMainBackground, 55),
121122
]
122123
);
123124
}

apps/theming/lib/Themes/DarkTheme.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getCSSVariables(): array {
115115

116116
'--color-border' => $this->util->lighten($colorMainBackground, 7),
117117
'--color-border-dark' => $this->util->lighten($colorMainBackground, 14),
118-
'--color-border-maxcontrast' => $this->util->lighten($colorMainBackground, 30),
118+
'--color-border-maxcontrast' => $this->util->lighten($colorMainBackground, 40),
119119

120120
'--background-invert-if-dark' => 'invert(100%)',
121121
'--background-invert-if-bright' => 'no',

apps/theming/lib/Themes/DefaultTheme.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function getCSSVariables(): array {
171171

172172
'--color-border' => $this->util->darken($colorMainBackground, 7),
173173
'--color-border-dark' => $this->util->darken($colorMainBackground, 14),
174-
'--color-border-maxcontrast' => $this->util->darken($colorMainBackground, 42),
174+
'--color-border-maxcontrast' => $this->util->darken($colorMainBackground, 51),
175175

176176
'--font-face' => "system-ui, -apple-system, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
177177
'--default-font-size' => '15px',

apps/theming/lib/Themes/HighContrastTheme.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public function getCSSVariables(): array {
121121

122122
'--color-border' => $this->util->darken($colorMainBackground, 50),
123123
'--color-border-dark' => $this->util->darken($colorMainBackground, 50),
124+
'--color-border-maxcontrast' => $this->util->darken($colorMainBackground, 56),
124125
]
125126
);
126127
}

apps/theming/tests/Themes/AccessibleThemeTestCase.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ public function dataAccessibilityPairs() {
7474
],
7575
$elementContrast,
7676
],
77+
'border-colors' => [
78+
[
79+
'--color-border-maxcontrast',
80+
],
81+
[
82+
'--color-main-background',
83+
'--color-background-hover',
84+
'--color-background-dark',
85+
'--color-main-background-blur',
86+
],
87+
$elementContrast,
88+
],
7789
// Those two colors are used for borders which will be `color-main-text` on focussed state, thus need 3:1 contrast to it
7890
'success-error-border-colors' => [
7991
[

0 commit comments

Comments
 (0)