[Feature Request] system theme aware detector hints, for github "sync with system"
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
- I searched for any existing report about this feature request to avoid opening a duplicate.
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
automatched while github was actually light - #15161 removed
autoagain, 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di darkreader/darkreader
-
Broken Website
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
darkreader/darkreader#15999 · 5 commenti ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
darkreader/darkreader#15570 ·
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 64/100
darkreader/darkreader#13250 ·
-
access needed Broken Website
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
darkreader/darkreader#16014 · 1 commento ·
-
Chrome Chromium Based Browsers MacOs Performance Issue
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
darkreader/darkreader#16006 · 3 commenti · 2 reazioni ·
Tutte le issue di darkreader/darkreader
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
TanStack/tanstack.com#1293 ·