usePrefersDarkMode
Thanks to useMedia, we can easily define a hook that allow us to query prefers-color-scheme through an operating system setting. So that, we can indicate that whether the current system is preferred the dark mode or not.
ThemeSetting.jsx
#
Options#
ReturnsprefersDarkMode: boolean
- Whether the current system is preferred the dark mode or not