Implement TODO: enhance dark mode detection#373
Open
tageniu wants to merge 3 commits intoalibaba:mainfrom
Open
Implement TODO: enhance dark mode detection#373tageniu wants to merge 3 commits intoalibaba:mainfrom
tageniu wants to merge 3 commits intoalibaba:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enhances dark mode detection in isPageDark() by adding additional heuristics beyond class and background checks to better handle modern frameworks and theming approaches.
Changes:
- Expanded dark-mode detection via additional HTML/body data attributes.
- Added detection via
<meta name="color-scheme">and computedcolor-schemeon:root. - Added layout-container background inspection and a light-text heuristic as additional signals.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Thanks for your contribution. Before I merge this PR. Please rebase and fix the following problems:
|
2fbe15d to
032f9a7
Compare
Resolve the @todo in checkDarkMode.ts by adding 3 new detection strategies and expanding data-attribute coverage: - Check data-color-mode, data-bs-theme, data-color-scheme attributes - Read CSS color-scheme property and <meta name="color-scheme"> tag - Inspect background of SPA containers (#app, #root, #__next, etc.) - Detect light text color as a dark-theme signal
032f9a7 to
3206ae4
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
3206ae4 to
c6f0937
Compare
Author
|
@gaomeng1900 the two problems were fixed. sorry for the delay! |
Author
|
@gaomeng1900 hi there, I've fixed the problem you mentioned, could you review and merge the pr? Thank you in advance! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Resolve the @todo in
checkDarkMode.tsby adding 3 new dark mode detection strategies and expanding data-attribute coverage:data-color-mode(GitHub),data-bs-theme(Bootstrap 5),data-color-schemeon both<html>and<body>color-scheme: read<meta name="color-scheme">and the computedcolor-schemeproperty on:root<main>,#app,#root,#__next,[role="main"]for SPAs where<body>stays transparentType
Testing
Requirements / 要求