fix(module): handle nested colors from ui config (#2008)

This commit is contained in:
Dave Stewart
2024-08-02 13:22:22 +01:00
committed by GitHub
parent 3411b89191
commit 1cc7e2a306
2 changed files with 4 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import { computed } from 'vue'
import { hexToRgb } from '../utils'
import { get, hexToRgb } from '../utils'
import { defineNuxtPlugin, useAppConfig, useNuxtApp, useHead } from '#imports'
import colors from '#tailwind-config/theme/colors'
@@ -8,8 +8,8 @@ export default defineNuxtPlugin(() => {
const nuxtApp = useNuxtApp()
const root = computed(() => {
const primary: Record<string, string> | undefined = colors[appConfig.ui.primary]
const gray: Record<string, string> | undefined = colors[appConfig.ui.gray]
const primary: Record<string, string> | undefined = get(colors, appConfig.ui.primary)
const gray: Record<string, string> | undefined = get(colors, appConfig.ui.gray)
if (!primary) {
console.warn(`[@nuxt/ui] Primary color '${appConfig.ui.primary}' not found in Tailwind config`)