79483015

Date: 2025-03-04 08:12:02
Score: 0.5
Natty:
Report link

You can keep the original form of input, textarea and select elements but direct browser to render them with dark mode assets.

Option element rendered in iOS Safari in dark mode iOS Safari

Option element rendered in Mac Safari in dark mode Mac Safari

Safari automatically renders those elements with dark mode assets; if your site reports to browser that it supports dark mode. To report support; set color-scheme property on :root. Such as:

:root {
    color-scheme: dark;
}

If your site supports both modes:

:root {
    color-scheme: light dark;
}

This works for both Mac and iOS version of Safari in version 18.

MDN: color-scheme

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: ufukty