-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: respond to the change of system theme appearance #877
Conversation
✅ Deploy Preview for aquamarine-blini-95325f ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi, thanks for your contribution. ❤️ Can you make separate PRs for each change? It will help us to review the changes. |
@chenjiahan It's possible, but the changes are dependent on each other, I can take a try. |
@chenjiahan You could review #878, #879 first |
Nice, and we can remove theme context. @sanyuan0704 |
But, have you tested it, I think it still flash in production when enable ssg. |
It's working in the Netlify Preview, even if the JavaScript is turned off, the images will not flash.
|
replaces the darkMode: boolean seems to introduce some breaking change? How about expand the type of darkMode, maybe like this? interface DarkModeSettings {
toggleButton: boolean;
defaultMode: "dark" | "light" | "auto";
}
type DarkModeConfig = boolean | DarkModeSettings;
darkMode?: DarkModeConfig; |
@Timeless0911 Thanks, rebased, this is the last PR, updated the description. |
Awesome |
Summary
Splits:
color-scheme
on root element, this is useful for theme styling based on native CSS media queries orlight-dark()
function, third-party libraries and creators may use this featureIn this PR, all the appearance related codes are refactored to a single React Hook, the checklist:
window.RSPRESS_THEME
, however, the use of global variables is flawed, see comments beblow #issuecomment-2027006896After these are done, we can use two patterns to display elements without flash:
Related Issue
Checklist
pnpm run change
.