magento2 – How to enable Dark Mode using Less

I’d like to enable the Dark Mode in Magento 2.

Using plain CSS I know it easily achieved by doing:

@media (prefers-color-scheme: dark) {
  .day.dark-scheme   { background:  #333; color: white; }
  .night.dark-scheme { background: black; color:  #ddd; }
}

How can I implement it in my Magento .less file instead?

I tried something like:

& when (@media = 'prefers-color-scheme: dark') {
  .day.dark-scheme   { background:  #333; color: white; }
  .night.dark-scheme { background: black; color:  #ddd; }
}

but it didn’t work.