Skip to content

Commit

Permalink
fix(useColorMode): resolve auto to preferred mode internally (#1766)
Browse files Browse the repository at this point in the history
Co-authored-by: dfreier <stone_stabiler.0x@icloud.com>
  • Loading branch information
dfreier and dfreier committed Jul 6, 2022
1 parent 428f502 commit 092cb19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/useColorMode/index.ts
Expand Up @@ -140,7 +140,8 @@ export function useColorMode<T extends string = BasicColorSchema>(options: UseCo
})

function defaultOnChanged(mode: T | BasicColorSchema) {
updateHTMLAttrs(selector, attribute, modes[mode] ?? mode)
const resolvedMode = mode === 'auto' ? preferredMode.value : mode
updateHTMLAttrs(selector, attribute, modes[resolvedMode] ?? resolvedMode)
}

function onChanged(mode: T | BasicColorSchema) {
Expand Down

0 comments on commit 092cb19

Please sign in to comment.