Skip to content
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

[Feature]: Auto Dark Mode for Web Contents #4656

Open
Shomnipotence opened this issue Jul 1, 2024 · 8 comments
Open

[Feature]: Auto Dark Mode for Web Contents #4656

Shomnipotence opened this issue Jul 1, 2024 · 8 comments
Labels
feature request feature request

Comments

@Shomnipotence
Copy link

Shomnipotence commented Jul 1, 2024

Describe the feature/enhancement you need

Automatically render all web contents using a dark theme

In the Android, this function has been integrated into the Android Webview
https://stackoverflow.com/questions/62548348/how-to-force-dark-web-pages-in-android-webview

The following shows the approximate effect of smart forced dark mode in Edge and Chrome browsers
image
image

image

The scenario/use case where you would use this feature

We often need to introduce dark mode web pages in the dark mode interface to achieve a consistent appearance. If the web page colors can be automatically inverted, it will greatly reduce the development cost of the web page - otherwise we will have to prepare two sets of color schemes for the web page.

Now, these operations sometimes rely on browser plug-ins, but if only individual web pages need to be accessed, introducing plug-ins for them is too bloated.

Edge includes this feature, namely
Auto Dark Mode for Web Contents

How important is this request to you?

Critical. My app's basic functions wouldn't work without it.

Suggested implementation

Enable this API in Webview

What does your app do? Is there a pending deadline for this request?

No response

@Shomnipotence Shomnipotence added the feature request feature request label Jul 1, 2024
@jls28
Copy link

jls28 commented Jul 1, 2024

You can activate the experimental dark mode(s) available here : edge://flags/#enable-force-dark

@Shomnipotence
Copy link
Author

You can activate the experimental dark mode(s) available here : edge://flags/#enable-force-dark

How can I enable it in WebView2?

@jls28
Copy link

jls28 commented Jul 1, 2024

Goto the address : edge://flags/#enable-force-dark
and (at section "Auto Dark Mode for Web Contents")
choose one of dark-mode availables in place of "Default".
You need to restart your app to apply.
It apply globally to all web pages visited.
(this work also with msEdge).

@victorhuangwq
Copy link
Collaborator

@Shomnipotence
Copy link
Author

Goto the address : edge://flags/#enable-force-dark and (at section "Auto Dark Mode for Web Contents") choose one of dark-mode availables in place of "Default". You need to restart your app to apply. It apply globally to all web pages visited. (this work also with msEdge).

My feedback is about WebView2, not Edge

@Shomnipotence
Copy link
Author

Shomnipotence commented Jul 2, 2024

@Danielx64
Copy link

Doesn't it relies on webpage having proper support being made to enable dark themes?

@Shomnipotence
Copy link
Author

Shomnipotence commented Jul 2, 2024

Doesn't it relies on webpage having proper support being made to enable dark themes?

No, this is a fallback for web pages that don't support dark mode. That's why it used to be called forced dark mode.

In theory, it follows this order
Forced dark/light mode
If the website developer provides a dark mode, it will automatically switch between dark and light colors instead of using code-based forced inversion of colors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request
Projects
None yet
Development

No branches or pull requests

4 participants