KevinnZou / compose-webview-multiplatform

WebView for JetBrains Compose Multiplatform
https://kevinnzou.github.io/compose-webview-multiplatform/
Apache License 2.0
305 stars 39 forks source link

Support for force dark theme #113

Closed gsrathoreniks closed 1 week ago

gsrathoreniks commented 2 months ago

I'm looking for support to force dark theme for android for Android version <13 also it would be great if we can inject a css to the loading url to force dark-mode.

KevinnZou commented 2 months ago

@gsrathoreniks Can you provide an example of how you implemented it in a raw Android WebView project?

gsrathoreniks commented 2 months ago

@KevinnZou Check this for reference : link

KevinnZou commented 2 months ago

@gsrathoreniks Thank you for providing the information. I checked it and discovered that it is only applicable to Android. Could you please elaborate on the plan for injecting a css to the loading URL in order to enforce dark mode? This solution appears to be more universal for both platforms.

gsrathoreniks commented 2 months ago

@KevinnZou By css injection I was referring to this link. If any website does not provide dark mode by itself, we can use this to force dark mode.

KevinnZou commented 2 months ago

@gsrathoreniks Thank you for the information! After conducting some research, it appears that iOS WkWebView supports prefers-color-scheme by default, while Android requires some configuration. I will add this issue to my plan, but it may take some time to implement since I am currently working on other issues. You are also welcome to submit a PR for it. Thank you for your suggestions again!

KevinnZou commented 2 months ago

@gsrathoreniks I have submitted a PR to make Android support dark mode. Could you have a review on it?

gsrathoreniks commented 1 month ago

@gsrathoreniks I have submitted a PR to make Android support dark mode. Could you have a review on it?

I'll have a look and update by this weekend.