Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Feature Request] system theme aware detector hints, for github "sync with system"

Aperta
#15,929 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia da detector.ts e segui il generatore, le definizioni, la configurazione e il test di configurazione menzionati nella richiesta. Esegui prima gli unit test esistenti; il lavoro è completato quando vengono rilevati i branch sync-with-system dark and light di GitHub senza ripristinare una semplice corrispondenza auto match.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Prerequisites
Is this feature request related to a problem?

Yes

Feature Request Description

i have github set to "sync with system" and my os is dark, so github renders its own dark theme. dark reader still applies its theme on top, with "detect dark theme" on.

the hint for github.com is:

TARGET
html

MATCH
[data-color-mode="dark"]

github only sets data-color-mode="dark" when you pick "single theme". with "sync with system" it stays auto, and the real theme comes from data-light-theme / data-dark-theme depending on prefers-color-scheme. so the selector never matches and dark reader keeps theming an already dark page.

i know this has history:

  • #11995 added [data-color-mode="auto"]
  • #15155 someone on a light os then got no dark mode at all, because auto matched while github was actually light
  • #15161 removed auto again, correctly
  • #15187 proposed MATCH SYSTEM DARK / MATCH SYSTEM LIGHT, closed

so a plain auto match is definitely wrong. but the case is still broken, and i dont think it can be fixed in the config alone, because Element.matches cant see prefers-color-scheme. the condition that is actually true is:

[data-color-mode="auto"] and (prefers-color-scheme: dark) and [data-dark-theme^="dark"]
or
[data-color-mode="auto"] and (prefers-color-scheme: light) and [data-light-theme^="dark"]

both branches are needed, because "sync with system" lets you pick any of the 12 themes per branch, so you can have a dark theme selected for the light branch. @Myshor confirmed that in #15187.

the existing SYSTEM THEME command doesnt cover it either, since it short circuits before MATCH and assumes the site always follows the system, which github doesnt when you use single theme.

what id like to do is add MATCH SYSTEM DARK and MATCH SYSTEM LIGHT to detector-hints, which add their selectors only when prefers-color-scheme matches, and use them for github. same idea as #15187, but only that, nothing else. about 25 lines across detector.ts, the generator, definitions, the config and the config test.

i have it written and the unit tests pass. happy to open the pr, or drop it if you'd rather not add new hint commands.

Screenshots

No response

Additional Context

dark reader 4.9.129, macos dark mode, github appearance set to "sync with system".

Lingua principale
TypeScript
Stelle
22.4k
Fork
2.8k
Merge medio
22h 56m
PR unite (30g)
61

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di darkreader/darkreader

Tutte le issue di darkreader/darkreader

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.