Skip to content

Commit dcd8034

Browse files
authored
increase contrast of code syntax highlights (#94)
1 parent af9b369 commit dcd8034

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

.changeset/tame-moons-fry.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@primer/doctocat-nextjs': patch
3+
---
4+
5+
Increase contrast of all `code span` syntax highlights in code fences on light mode.
6+
7+
Before: 4.31:1 AA (fails WCAG AA)
8+
After: 5.03:1 AA (passes WCAG AA)

packages/theme/css/global.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
html,
66
body {
77
background-color: var(--brand-color-canvas-default) !important;
8-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
9-
'Segoe UI Emoji';
8+
font-family:
9+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
1010
}
1111

1212
[data-color-mode='dark'] {
@@ -39,6 +39,11 @@ code span {
3939
color: var(--shiki-light);
4040
}
4141

42+
/* Override shiki-light keyword color for better contrast */
43+
code span[style*='--shiki-light:#D73A49'] {
44+
--shiki-light: var(--base-color-scale-red-5) !important;
45+
}
46+
4247
[data-color-mode='dark'] code span {
4348
color: var(--shiki-dark);
4449
}

0 commit comments

Comments
 (0)