The Matlab R2025a web command replaces the previous web browser that returned a Java object "com.mathworks.mde.webbrowser.WebBrowser" with matlab.htmlviewer.HTMLViewer as part of the Matlab Java internals purge that frees Matlab from depending on Java for essential GUI elements in R2025a and beyond.
The Matlab browser default style sheet for the internal web browser is broken on the CSS color-scheme meta tag.
<meta name="color-scheme" content="dark light">
or
<meta name="color-scheme" content="light dark">
may render as white text on white background in dark mode.
This is relevant as HTML generated with Matlab publish command may not render properly in Matlab's HTMLViewer.
Set a custom CSS style sheet (like the style.css of this demo) that defines colors for both light and dark modes. This fixes browsers like Matlab's with broken default stylesheets. Refer to the style.css file in the head section of the HTML file(s).
<head>
<meta name="color-scheme" content="dark light">
<link rel="stylesheet" href="style.css">
</head>
These issues are fixed as in the section above by using a custom CSS style sheet.
Matlab release | Working | Partly Working | Broken |
---|---|---|---|
R2025a macOS, Windows | normal, light | dark-light, dark (text renders white on white) | |
R2024b Linux | normal, light, dark | dark-light (renders as light theme) | |
R2024b macOS | normal, light | dark-light (renders as light theme) | dark (text renders white on white) |
R2024a Linux, macOS | normal, light, dark | dark-light (renders as light theme) | |
R2023b, R2023a Linux | normal, light, dark | dark-light (renders as light theme) |
- R2025a, R2024b:
matlab.htmlviewer.HTMLViewer
- Matlab <= R2024a:
com.mathworks.mde.webbrowser.WebBrowser