naive-ui/demo/documentation/components/config-provider/enUS/os-theme.demo.md

353 B

Use OS Theme

Naive UI provides useOsTheme to get the current theme of your OS.

<n-config-provider :theme="theme">
  <n-card>
    Your current system theme is {{ theme }}.
  </n-card>
</n-config-provider>
import { useOsTheme } from 'naive-ui'

export default {
  setup () {
    return {
      theme: useOsTheme()
    }
  }
}