[Feature Request] system theme aware detector hints, for github "sync with system"
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với detector.ts và lần theo generator, definitions, config và config test được đề cập trong yêu cầu. Trước tiên, hãy chạy các unit test hiện có; hoàn tất nghĩa là các nhánh sync-with-system dark and light của GitHub được phát hiện mà không khôi phục một auto match đơn giản.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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".
- Ngôn ngữ chính
- TypeScript
- Star
- 22.4k
- Fork
- 2.8k
- Merge trung bình
- 23 giờ 34 phút
- Pull request đã merge (30 ngày)
- 59
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của darkreader/darkreader
-
Broken Website
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
darkreader/darkreader#15999 · 5 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
darkreader/darkreader#15570 ·
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 64/100
darkreader/darkreader#13250 ·
-
access needed Broken Website
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
darkreader/darkreader#16014 · 1 bình luận ·
-
Chrome Chromium Based Browsers MacOs Performance Issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
darkreader/darkreader#16006 · 3 bình luận · 2 reaction ·
Tất cả issue của darkreader/darkreader
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
bcgov/bc-wallet-mobile#4761 · 1 bình luận ·
-
external-issue to-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
area-deployment area-integrations triage:bot-seen
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100