<Dark Mode Test

by Fran T

Version 3 (March 2, 2024)

Download (26 downloads)

Demonstrates dark mode reported by the Dialog Web block. Automate 1.42 added partial support, following the theme set for the device. However, if the theme for Automate itself is set to Dark, Dialog Web will always report that dark mode is enabled, regardless of system setting. I think this is a bug.

The first web dialog uses

window.matchMedia('(prefers-color-scheme: dark)').matches

to test whether dark mode is enabled.

The second dialog uses a @media style to set the background color of the 'body' element to black if dark mode is enabled.