Jump to content
dport

disabling fmx webbrowser dark mode

Recommended Posts

is it possible to turn off dark mode setting of webbrowser in android 

Share this post


Link to post

I may have a solution, however I'm having trouble verifying that it works. What are the steps to reproduce that the website will definitely show in dark mode? At present, all I'm doing is navigating to https://www.google.com, and TWebBrowser shows the site in light mode, despite the Chrome app showing it in dark mode (which is what my device is set to)

Share this post


Link to post

I added head section html:

 

<meta name="color-scheme" content="light only"></head>
<style>
:root {
         color-scheme: light only;
       }
</style>

I added it to the html codes but there must be a setting to force twebrowser

Share this post


Link to post
1 hour ago, dport said:

I added it to the html codes but there must be a setting to force twebrowser

It's possible there is. My question was: What are the steps to reproduce that the website will definitely show in dark mode? Then I can test that the code will force it into light mode

Share this post


Link to post
On 5/2/2022 at 2:23 PM, Dave Nottage said:

It's possible there is. My question was: What are the steps to reproduce that the website will definitely show in dark mode? Then I can test that the code will force it into light mode

I am creating dynamic webbrowser content like:

WebBrowser1.EvaluateJavaScript('document.write("hello");');

I add style section before html content to force light mode.

 

WebBrowser1.EvaluateJavaScript('<html><head><meta name="color-scheme" content="light only"></head><style>:root {         color-scheme: light only;  }</style></head><body>');

WebBrowser1.EvaluateJavaScript('document.write("hello");');

I am looking a settings webbrowser force light mode or disable dark mode.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×