Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/usePreferredColorScheme.md
1---2category: Browser3---45# usePreferredColorScheme67Reactive [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media query.89## Usage1011```ts12import { usePreferredColorScheme } from '@vueuse/core'1314const preferredColor = usePreferredColorScheme()15```1617## Component Usage1819```vue20<template>21<UsePreferredColorScheme v-slot="{ colorScheme }">22Preferred Color Scheme: {{ colorScheme }}23</UsePreferredColorScheme>24</template>25```2627## Type Declarations2829```ts30export type ColorSchemeType = "dark" | "light" | "no-preference"31/**32* Reactive prefers-color-scheme media query.33*34* @see https://vueuse.org/usePreferredColorScheme35* @param [options]36*37* @__NO_SIDE_EFFECTS__38*/39export declare function usePreferredColorScheme(40options?: ConfigurableWindow,41): ComputedRef<ColorSchemeType>42```43