Commit 2befc94
committed
[fix] Made dark syntax highlighting follow the theme toggle
Sphinx 9 and sphinxawesome-theme 6 gate the dark Pygments palette on
`@media (prefers-color-scheme: dark)`, both in the block appended to
pygments.css and in the separately media-linked pygments_dark.css.
The theme, however, toggles dark mode with a `.dark` class on <html>
that is persisted in localStorage and can diverge from the OS
preference (for example the site is kept dark while the OS turns
light at dawn). The code blocks therefore switched palette
independently of the rest of the page, producing low-contrast,
unreadable syntax highlighting.
Re-scope the dark palette under `.dark` so the syntax colors track
the same toggle as the rest of the theme.1 parent 1d10dd3 commit 2befc94
1 file changed
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
511 | | - | |
| 511 | + | |
512 | 512 | | |
513 | | - | |
514 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
515 | 518 | | |
516 | 519 | | |
517 | 520 | | |
| |||
520 | 523 | | |
521 | 524 | | |
522 | 525 | | |
523 | | - | |
524 | | - | |
525 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
526 | 536 | | |
527 | 537 | | |
528 | 538 | | |
| |||
0 commit comments