Skip to content

Commit 51b0324

Browse files
enable colorblind mode in contrast check (#1066)
* enable colorblind mode in contrast check * working on fixing colorblind contrast * enable and fix tritanopia
1 parent 8d72963 commit 51b0324

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

.changeset/gentle-toys-cough.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/primitives': patch
3+
---
4+
5+
Fixes for colorblind themes

scripts/color-contrast.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,16 @@ const getColorsFromFiles = async (filePaths: ThemeName[]): Promise<Theme[]> => {
188188
* RUN CODE
189189
*/
190190
const runCheck = async () => {
191-
const themesNamesToCheck = ['light', 'dark', 'light_high_contrast', 'dark_high_contrast'] as ThemeName[]
191+
const themesNamesToCheck = [
192+
'light',
193+
'dark',
194+
'light_high_contrast',
195+
'dark_high_contrast',
196+
'light_colorblind',
197+
'dark_colorblind',
198+
'light_tritanopia',
199+
'dark_tritanopia',
200+
] as ThemeName[]
192201
// get colors from doc json files
193202
const themes = await getColorsFromFiles(themesNamesToCheck)
194203
// check contrast for themes

src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$type: 'color',
1111
},
1212
danger: {
13-
$value: '{base.color.orange.4}',
13+
$value: '{base.color.orange.3}',
1414
$type: 'color',
1515
},
1616
open: {
@@ -49,7 +49,7 @@
4949
muted: {
5050
$value: '{base.color.orange.4}',
5151
$type: 'color',
52-
alpha: 0.4,
52+
alpha: 0.2,
5353
},
5454
emphasis: {
5555
$value: '{base.color.orange.5}',

src/tokens/functional/color/dark/overrides/dark.tritanopia.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
muted: {
5050
$value: '{base.color.red.4}',
5151
$type: 'color',
52-
alpha: 0.15,
52+
alpha: 0.1,
5353
},
5454
emphasis: {
5555
$value: '{base.color.red.5}',

src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
danger: {
2121
$value: '{base.color.orange.5}',
2222
$type: 'color',
23-
mix: {
24-
color: '{base.color.orange.4}',
25-
weight: 0.05,
26-
},
2723
},
2824
},
2925
bgColor: {
@@ -40,12 +36,11 @@
4036
},
4137
open: {
4238
muted: {
43-
$value: '{base.color.orange.3}',
39+
$value: '{base.color.orange.0}',
4440
$type: 'color',
45-
alpha: 0.4,
4641
},
4742
emphasis: {
48-
$value: '{base.color.orange.4}',
43+
$value: '{base.color.orange.5}',
4944
$type: 'color',
5045
},
5146
},

0 commit comments

Comments
 (0)