Closed therealokoro closed 1 year ago
You also need to set the theme type for unocss
Please refer to the following https://github.com/Dunqing/unocss-preset-theme/blob/f2419617670bdcb5eb12b4b4850e2af49418ec75/playground/vite.config.ts#L10
Uhm... So i'm using unocss with nuxt 3 and my config lies in an unocss.config.ts
file not in vite.config.ts. This means that the unocss export from vite is not needed. So how do I then use this preset?
How about you try using this preset with nuxt 3.
Here's an example of my config.
export default defineConfig({
theme: {},
presets: [
presetUno(),
presetAttributify(),
presetIcons({ scale: 1.2 }),
presetForms(),
presetTheme<Theme>({
theme: {
dark: {
colors: {
primary: "#1668dc",
"primary-border": "#1668dc",
border: "#424242"
}
}
}),
transformers: [transformerDirectives(), transformerVariantGroup()]
})
Just like this
export default defineConfig<Theme>({...})
Works like a charm👌. Nice one
So one more thing. I think it would be nice if the plugin could convert colors to rgba so as to respect a opacity when available.
Currently when you pass in a color value(except for color names) to the color property in the default theme option of unocss, It's converted to rgba so if in usage, an opacity is passed, then it can be used.
See examples below.
Notice how the rgb color value passed to the color property in the config was converted rgba so it could respect opacity.
Notice that it ignores the possibility of have opacity.
I do hope that this is clear enough. Thanks
Beautiful work @Dunqing.
Tried using this plugin, but vscode keeps shouting at me about this