From 2b7c5c575f6aaeaa6dccc121fd52444bb5ed4a24 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 23 Oct 2023 17:00:33 +0200 Subject: [PATCH] docs(theming): improve colors customization with tailwind --- docs/content/1.getting-started/3.theming.md | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/content/1.getting-started/3.theming.md b/docs/content/1.getting-started/3.theming.md index 3a9ec6c9..b31ab2ca 100644 --- a/docs/content/1.getting-started/3.theming.md +++ b/docs/content/1.getting-started/3.theming.md @@ -27,6 +27,35 @@ Try to change the `primary` and `gray` colors by clicking on the :u-icon{name="i As this module uses Tailwind CSS under the hood, you can use any of the [Tailwind CSS colors](https://tailwindcss.com/docs/customizing-colors#color-palette-reference) or your own custom colors. By default, the `primary` color is `green` and the `gray` color is `cool`. +When [using custom colors](https://tailwindcss.com/docs/customizing-colors#using-custom-colors) or [adding additional colors](https://tailwindcss.com/docs/customizing-colors#adding-additional-colors) through the `extend` key in your `tailwind.config.ts`, you'll need to make sure to define all the shades from `50` to `950` as most of them are used in the components config defined in [`ui.config.ts`](https://github.com/nuxt/ui/blob/dev/src/runtime/ui.config.ts). You can [generate your colors](https://tailwindcss.com/docs/customizing-colors#generating-colors) using tools such as https://uicolors.app/ for example. + +```ts [tailwind.config.ts] +import type { Config } from 'tailwindcss' +import defaultTheme from 'tailwindcss/defaultTheme' + +export default >{ + theme: { + extend: { + colors: { + green: { + 50: '#EFFDF5', + 100: '#D9FBE8', + 200: '#B3F5D1', + 300: '#75EDAE', + 400: '#00DC82', + 500: '#00C16A', + 600: '#00A155', + 700: '#007F45', + 800: '#016538', + 900: '#0A5331', + 950: '#052e16' + } + } + } + } +} +``` + ### CSS Variables To provide dynamic colors that can be changed at runtime, this module uses CSS variables. As Tailwind CSS already has a `gray` color, the module automatically renames it to `cool` to avoid conflicts (`coolGray` was renamed to `gray` when Tailwind CSS v3.0 was released).