mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 13:44:39 +08:00
This CL provides a script that generates a dark mode stylesheet for a given sheet, just like the runtime color patching (in fact, it uses the same code!). The script loads up the given CSS file, imports `ThemeSupport`, and patches it. It then takes the final CSS file and prefixes `:host-context(.-theme-with-dark-background)` to each selector. We can then load the lightmode and the dark mode stylesheet into DevTools. This is non ideal because we end up loading two stylesheets, but the alternative is to maintain the runtime color patching for ever, or update all third party stylesheets to use our CSS variables, which is a lot of work. The script does rely on the hosted mode server running but I think this is reasonable; it's only going to be run rarely on a few CSS files, so we won't be running it automatically on CI or anything so we can keep the process fairly manual. Bug: 1152736 Change-Id: I707c53fbccb3e03c9fac6691f40df32bcdb17c1f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2587024 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>