TTMSFNCWebBrowser Background

I´m using the TTMSFNCWebBrowser (FMX) for displaying the HTML of emails. When the system color is set to dark. The background is also automatically set to dark. That is expected behavior.

The problem is that i can´t control the content of the emails so most of the time the text is dark and the background as well.

Is there a way to overwrite the system default background color to white?

For the browser you could use the defaultbackgroundcolor (add the unit FMX.TMSFNCWebBrowser.Win, it's a windows only feature

procedure TForm1.TMSFNCWebBrowser1Initialized(Sender: TObject);
var
  c: ICoreWebView2Controller;
  c2: ICoreWebView2Controller2;
  cl: COREWEBVIEW2_COLOR;
begin
  c := ICoreWebView2Controller(TMSFNCWebBrowser1.NativeBrowser);
  if c.QueryInterface(IID_ICoreWebView2Controller2, c2) = S_OK then
  begin
    cl.A := 255;
    cl.R := 255;
    cl.B := 0;
    cl.G := 0;
    c2.put_DefaultBackgroundColor(cl);
  end;
end;
1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.