Color Design Specifications
Naive UI uses a carefully designed color system with primary green color and semantic colors for different states, providing a consistent look and feel for the products you build.
When to Use
- Understanding the color system
- Applying brand colors correctly
- Using semantic colors (success, warning, error, info)
- Working with neutral colors for text and backgrounds
- Creating themed components
Primary Color
The main color of Naive UI is a vibrant green (#18a058) that conveys freshness and growth.
| Color |
CSS Variable |
Light Theme |
Dark Theme |
Usage |
| Primary |
--primary-color |
#18a058 |
#63e2b7 |
Main brand color |
| Primary Hover |
--primary-color-hover |
#36ad6a |
#7fe7c4 |
Hover state |
| Primary Pressed |
--primary-color-pressed |
#0c7a43 |
#5acea7 |
Active/pressed state |
| Primary Suppl |
--primary-color-suppl |
#36ad6a |
rgb(42, 148, 125) |
Supplementary |
Semantic Colors
Semantic colors are used in different scenarios to convey meaning.
Success
| CSS Variable |
Light Theme |
Dark Theme |
Usage |
--success-color |
#18a058 |
#63e2b7 |
Success operations |
--success-color-hover |
#36ad6a |
#7fe7c4 |
Hover state |
--success-color-pressed |
#0c7a43 |
#5acea7 |
Active state |
--success-color-suppl |
#36ad6a |
rgb(42, 148, 125) |
Supplementary |
Info
| CSS Variable |
Light Theme |
Dark Theme |
Usage |
--info-color |
#2080f0 |
#70c0e8 |
Information operations |
--info-color-hover |
#4098fc |
#8acbec |
Hover state |
--info-color-pressed |
#1060c9 |
#66afd3 |
Active state |
--info-color-suppl |
#4098fc |
rgb(56, 137, 197) |
Supplementary |
Warning
| CSS Variable |
Light Theme |
Dark Theme |
Usage |
--warning-color |
#f0a020 |
#f2c97d |
Warning operations |
--warning-color-hover |
#fcb040 |
#f5d599 |
Hover state |
--warning-color-pressed |
#c97c10 |
#e6c260 |
Active state |
--warning-color-suppl |
#fcb040 |
rgb(240, 138, 0) |
Supplementary |
Error
| CSS Variable |
Light Theme |
Dark Theme |
Usage |
--error-color |
#d03050 |
#e88080 |
Error/danger operations |
--error-color-hover |
#de576d |
#e98b8b |
Hover state |
--error-color-pressed |
#ab1f3f |
#e57272 |
Active state |
--error-color-suppl |
#de576d |
rgb(208, 58, 82) |
Supplementary |
Text Colors
Naive UI uses a hierarchical text color system for visual clarity.
Light Theme
| CSS Variable |
Value |
Usage |
--text-color-base |
#000 |
Base text color |
--text-color-1 |
rgb(31, 34, 37) |
Primary text - headings, important content |
--text-color-2 |
rgb(51, 54, 57) |
Secondary text - body content |
--text-color-3 |
rgb(118, 124, 130) |
Tertiary text - captions, hints |
--text-color-disabled |
rgba(0, 0, 0, 0.24) |
Disabled text |
--placeholder-color |
rgba(0, 0, 0, 0.24) |
Placeholder text |
--placeholder-color-disabled |
rgba(0, 0, 0, 0.18) |
Disabled placeholder |
Dark Theme
| CSS Variable |
Value |
Usage |
--text-color-base |
#fff |
Base text color |
--text-color-1 |
rgba(255, 255, 255, 0.9) |
Primary text |
--text-color-2 |
rgba(255, 255, 255, 0.82) |
Secondary text |
--text-color-3 |
rgba(255, 255, 255, 0.52) |
Tertiary text |
--text-color-disabled |
rgba(255, 255, 255, 0.38) |
Disabled text |
--placeholder-color |
rgba(255, 255, 255, 0.38) |
Placeholder text |
--placeholder-color-disabled |
rgba(255, 255, 255, 0.28) |
Disabled placeholder |
Background Colors
Light Theme
| CSS Variable |
Value |
Usage |
--base-color |
#fff |
Base background |
--body-color |
#fff |
Body background |
--card-color |
#fff |
Card background |
--modal-color |
#fff |
Modal background |
--popover-color |
#fff |
Popover background |
--table-color |
#fff |
Table background |
--hover-color |
rgb(243, 243, 245) |
Hover state background |
--pressed-color |
rgb(237, 237, 239) |
Pressed state background |
--action-color |
rgb(250, 250, 252) |
Action area background |
--input-color |
#fff |
Input background |
Dark Theme
| CSS Variable |
Value |
Usage |
--base-color |
#000 |
Base background |
--body-color |
rgb(16, 16, 20) |
Body background |
--card-color |
rgb(24, 24, 28) |
Card background |
--modal-color |
rgb(44, 44, 50) |
Modal background |
--popover-color |
rgb(72, 72, 78) |
Popover background |
--table-color |
rgb(24, 24, 28) |
Table background |
--hover-color |
rgba(255, 255, 255, 0.09) |
Hover state background |
--pressed-color |
rgba(255, 255, 255, 0.05) |
Pressed state background |
--action-color |
rgba(255, 255, 255, 0.06) |
Action area background |
--input-color |
rgba(255, 255, 255, 0.1) |
Input background |
Border & Divider Colors
| CSS Variable |
Light Theme |
Dark Theme |
Usage |
--border-color |
rgb(224, 224, 230) |
rgba(255, 255, 255, 0.24) |
Default border |
--divider-color |
rgb(239, 239, 245) |
rgba(255, 255, 255, 0.09) |
Divider lines |
Using Theme Variables
In CSS (with n-element)
<template>
<n-config-provider :theme="theme">
<n-card>
<n-el
tag="span"
style="
color: var(--primary-color);
transition: 0.3s var(--cubic-bezier-ease-in-out);
"
>
Styled with theme variables
</n-el>
</n-card>
</n-config-provider>
</template>
In JavaScript (with useThemeVars)
<script setup>
import { useThemeVars } from 'naive-ui'
const themeVars = useThemeVars()
</script>
<template>
<div :style="{ color: themeVars.primaryColor }">
Primary color text
</div>
</template>
CSS Variables Summary
:root {
--primary-color: #18a058;
--primary-color-hover: #36ad6a;
--primary-color-pressed: #0c7a43;
--success-color: #18a058;
--info-color: #2080f0;
--warning-color: #f0a020;
--error-color: #d03050;
--text-color-1: rgb(31, 34, 37);
--text-color-2: rgb(51, 54, 57);
--text-color-3: rgb(118, 124, 130);
--base-color: #fff;
--body-color: #fff;
--card-color: #fff;
--modal-color: #fff;
--border-color: rgb(224, 224, 230);
--divider-color: rgb(239, 239, 245);
}
Best Practices
- Use CSS Variables: Always use predefined color variables via
useThemeVars() or var(--xxx) for consistency
- Semantic Colors: Use appropriate semantic colors for their intended purpose
- Text Hierarchy: Use text color variables to establish visual hierarchy
- Dark Mode Support: Colors automatically adjust when using dark theme
- Customization: Override theme variables via
n-config-provider to match your brand
- State Colors: Use hover/pressed variants for interactive elements
Related Resources
1---2name: naive-ui-design-color3description: Color design specifications for Naive UI. Invoke when user needs to understand the color palette, main colors, semantic colors, or neutral colors used in Naive UI.4---56# Color Design Specifications78Naive UI uses a carefully designed color system with primary green color and semantic colors for different states, providing a consistent look and feel for the products you build.910## When to Use1112- Understanding the color system13- Applying brand colors correctly14- Using semantic colors (success, warning, error, info)15- Working with neutral colors for text and backgrounds16- Creating themed components1718---1920## Primary Color2122The main color of Naive UI is a vibrant green (#18a058) that conveys freshness and growth.2324| Color | CSS Variable | Light Theme | Dark Theme | Usage |25|-------|--------------|-------------|------------|-------|26| Primary | `--primary-color` | `#18a058` | `#63e2b7` | Main brand color |27| Primary Hover | `--primary-color-hover` | `#36ad6a` | `#7fe7c4` | Hover state |28| Primary Pressed | `--primary-color-pressed` | `#0c7a43` | `#5acea7` | Active/pressed state |29| Primary Suppl | `--primary-color-suppl` | `#36ad6a` | `rgb(42, 148, 125)` | Supplementary |3031---3233## Semantic Colors3435Semantic colors are used in different scenarios to convey meaning.3637### Success3839| CSS Variable | Light Theme | Dark Theme | Usage |40|--------------|-------------|------------|-------|41| `--success-color` | `#18a058` | `#63e2b7` | Success operations |42| `--success-color-hover` | `#36ad6a` | `#7fe7c4` | Hover state |43| `--success-color-pressed` | `#0c7a43` | `#5acea7` | Active state |44| `--success-color-suppl` | `#36ad6a` | `rgb(42, 148, 125)` | Supplementary |4546### Info4748| CSS Variable | Light Theme | Dark Theme | Usage |49|--------------|-------------|------------|-------|50| `--info-color` | `#2080f0` | `#70c0e8` | Information operations |51| `--info-color-hover` | `#4098fc` | `#8acbec` | Hover state |52| `--info-color-pressed` | `#1060c9` | `#66afd3` | Active state |53| `--info-color-suppl` | `#4098fc` | `rgb(56, 137, 197)` | Supplementary |5455### Warning5657| CSS Variable | Light Theme | Dark Theme | Usage |58|--------------|-------------|------------|-------|59| `--warning-color` | `#f0a020` | `#f2c97d` | Warning operations |60| `--warning-color-hover` | `#fcb040` | `#f5d599` | Hover state |61| `--warning-color-pressed` | `#c97c10` | `#e6c260` | Active state |62| `--warning-color-suppl` | `#fcb040` | `rgb(240, 138, 0)` | Supplementary |6364### Error6566| CSS Variable | Light Theme | Dark Theme | Usage |67|--------------|-------------|------------|-------|68| `--error-color` | `#d03050` | `#e88080` | Error/danger operations |69| `--error-color-hover` | `#de576d` | `#e98b8b` | Hover state |70| `--error-color-pressed` | `#ab1f3f` | `#e57272` | Active state |71| `--error-color-suppl` | `#de576d` | `rgb(208, 58, 82)` | Supplementary |7273---7475## Text Colors7677Naive UI uses a hierarchical text color system for visual clarity.7879### Light Theme8081| CSS Variable | Value | Usage |82|--------------|-------|-------|83| `--text-color-base` | `#000` | Base text color |84| `--text-color-1` | `rgb(31, 34, 37)` | Primary text - headings, important content |85| `--text-color-2` | `rgb(51, 54, 57)` | Secondary text - body content |86| `--text-color-3` | `rgb(118, 124, 130)` | Tertiary text - captions, hints |87| `--text-color-disabled` | `rgba(0, 0, 0, 0.24)` | Disabled text |88| `--placeholder-color` | `rgba(0, 0, 0, 0.24)` | Placeholder text |89| `--placeholder-color-disabled` | `rgba(0, 0, 0, 0.18)` | Disabled placeholder |9091### Dark Theme9293| CSS Variable | Value | Usage |94|--------------|-------|-------|95| `--text-color-base` | `#fff` | Base text color |96| `--text-color-1` | `rgba(255, 255, 255, 0.9)` | Primary text |97| `--text-color-2` | `rgba(255, 255, 255, 0.82)` | Secondary text |98| `--text-color-3` | `rgba(255, 255, 255, 0.52)` | Tertiary text |99| `--text-color-disabled` | `rgba(255, 255, 255, 0.38)` | Disabled text |100| `--placeholder-color` | `rgba(255, 255, 255, 0.38)` | Placeholder text |101| `--placeholder-color-disabled` | `rgba(255, 255, 255, 0.28)` | Disabled placeholder |102103---104105## Background Colors106107### Light Theme108109| CSS Variable | Value | Usage |110|--------------|-------|-------|111| `--base-color` | `#fff` | Base background |112| `--body-color` | `#fff` | Body background |113| `--card-color` | `#fff` | Card background |114| `--modal-color` | `#fff` | Modal background |115| `--popover-color` | `#fff` | Popover background |116| `--table-color` | `#fff` | Table background |117| `--hover-color` | `rgb(243, 243, 245)` | Hover state background |118| `--pressed-color` | `rgb(237, 237, 239)` | Pressed state background |119| `--action-color` | `rgb(250, 250, 252)` | Action area background |120| `--input-color` | `#fff` | Input background |121122### Dark Theme123124| CSS Variable | Value | Usage |125|--------------|-------|-------|126| `--base-color` | `#000` | Base background |127| `--body-color` | `rgb(16, 16, 20)` | Body background |128| `--card-color` | `rgb(24, 24, 28)` | Card background |129| `--modal-color` | `rgb(44, 44, 50)` | Modal background |130| `--popover-color` | `rgb(72, 72, 78)` | Popover background |131| `--table-color` | `rgb(24, 24, 28)` | Table background |132| `--hover-color` | `rgba(255, 255, 255, 0.09)` | Hover state background |133| `--pressed-color` | `rgba(255, 255, 255, 0.05)` | Pressed state background |134| `--action-color` | `rgba(255, 255, 255, 0.06)` | Action area background |135| `--input-color` | `rgba(255, 255, 255, 0.1)` | Input background |136137---138139## Border & Divider Colors140141| CSS Variable | Light Theme | Dark Theme | Usage |142|--------------|-------------|------------|-------|143| `--border-color` | `rgb(224, 224, 230)` | `rgba(255, 255, 255, 0.24)` | Default border |144| `--divider-color` | `rgb(239, 239, 245)` | `rgba(255, 255, 255, 0.09)` | Divider lines |145146---147148## Using Theme Variables149150### In CSS (with n-element)151152```vue153<template>154 <n-config-provider :theme="theme">155 <n-card>156 <n-el157 tag="span"158 style="159 color: var(--primary-color);160 transition: 0.3s var(--cubic-bezier-ease-in-out);161 "162 >163 Styled with theme variables164 </n-el>165 </n-card>166 </n-config-provider>167</template>168```169170### In JavaScript (with useThemeVars)171172```vue173<script setup>174import { useThemeVars } from 'naive-ui'175176const themeVars = useThemeVars()177</script>178179<template>180 <div :style="{ color: themeVars.primaryColor }">181 Primary color text182 </div>183</template>184```185186---187188## CSS Variables Summary189190```css191:root {192 --primary-color: #18a058;193 --primary-color-hover: #36ad6a;194 --primary-color-pressed: #0c7a43;195 196 --success-color: #18a058;197 --info-color: #2080f0;198 --warning-color: #f0a020;199 --error-color: #d03050;200 201 --text-color-1: rgb(31, 34, 37);202 --text-color-2: rgb(51, 54, 57);203 --text-color-3: rgb(118, 124, 130);204 205 --base-color: #fff;206 --body-color: #fff;207 --card-color: #fff;208 --modal-color: #fff;209 210 --border-color: rgb(224, 224, 230);211 --divider-color: rgb(239, 239, 245);212}213```214215---216217## Best Practices2182191. **Use CSS Variables**: Always use predefined color variables via `useThemeVars()` or `var(--xxx)` for consistency2202. **Semantic Colors**: Use appropriate semantic colors for their intended purpose2213. **Text Hierarchy**: Use text color variables to establish visual hierarchy2224. **Dark Mode Support**: Colors automatically adjust when using dark theme2235. **Customization**: Override theme variables via `n-config-provider` to match your brand2246. **State Colors**: Use hover/pressed variants for interactive elements225226---227228## Related Resources229230| Resource | Description |231|----------|-------------|232| [useThemeVars](https://www.naiveui.com/en-US/os-theme/docs/theme) | Access theme variables in JavaScript |233| [n-element](https://www.naiveui.com/en-US/os-theme/components/element) | Use CSS variables in templates |234| [n-config-provider](https://www.naiveui.com/en-US/os-theme/components/config-provider) | Theme customization |