After upgrading Robot Framework from 6.1 to 7.1.1, I noticed that the report now supports a dark theme
However, most of our users prefer the light theme, and many don’t realize there’s a toggle button in the lower-right corner of the report to switch between themes.
Is there a way to set the default theme to light ?
Thanks in advance!
It seems there’s no direct configuration option to set the default theme in Robot Framework reports.
However, there is a workaround:
The report checks the URL for a theme
parameter, as shown in the view.js
:
function getPreference() {
if (urlParams.has('theme')) {
var urlTheme = urlParams.get('theme') === 'dark' ? 'dark' : 'light';
storage.set(storageKey, urlTheme);
urlParams.delete('theme');
return urlTheme;
}
if (storage.get(storageKey))
return storage.get(storageKey) === 'dark' ? 'dark' : 'light';
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
Append ?theme=light
(or ?theme=dark
) to the report URL to force the desired theme.
Example:
report.html?theme=light