Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#15,929 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
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".

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

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của darkreader/darkreader

Tất cả issue của darkreader/darkreader

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.