Color
Color helps distinguish an action from text, and a normal state from a warning or error. Its role must be maintained across all pages of the application.
Color roles
| Role | Application | Design token |
|---|---|---|
| Main | Main action, selected item | colorPrimary |
| Success | Completed operation | colorSuccess |
| Warning | Situation requiring attention | colorWarning |
| Error | Failed action or incorrect input | colorError |
| Text and surfaces | Reading, background, borders | colorText, colorBgContainer, colorBorder |
Don't represent a state with just one color: add a signature, icon, or message. Adjacent elements must be distinguishable even without hue recognition.
Product palette
Ant Design has basic color palettes and neutral shades. In your product, choose a primary color and use semantic roles consistently. To configure, pass colorPrimary to the ConfigProvider theme.
Don't fix white background and black text in app components: use current theme tokens to maintain readability in dark mode.
colorPrimarycolorPrimaryBgcolorLinkChecking states
Compare normal, hover, focus, active and disabled states. Check the text on top of the selected fill and the errors on the background of the field. Setting up a theme describes common and component tokens, and ColorPicker allows you to work with custom color.
Model and system levels
Ant Design distinguishes system palettes from product palettes. The system defines coordinated hues, neutral colours and a foundation for visualisation. A product selects a primary colour and connects other roles with its tasks. HSB separates hue, saturation and brightness when discussing a colour independently of its CSS representation.
Base palettes
The base system contains twelve colour families with ten steps each. The sixth step of a light palette is commonly used as a primary colour; other steps support backgrounds, borders and interaction states. Dark mode recalculates relationships for its surroundings.
The palette below reads current public theme tokens. Selecting a primary colour recalculates its semantic roles within the example. The header theme settings let you compare light and dark systems without copying values from CSS.
- colorPrimaryBg
#e6f4ff- colorPrimaryBorder
#91caff- colorPrimaryHover
#4096ff- colorPrimary
#1677ff- colorPrimaryActive
#0958d9- colorText
rgba(0,0,0,0.88)- colorTextSecondary
rgba(0,0,0,0.65)- colorBgContainer
#ffffff
red
#fff1f01#ffccc72#ffa39e3#ff78754#ff4d4f5#f5222d6#cf13227#a8071a8#8200149#5c001110
volcano
#fff2e81#ffd8bf2#ffbb963#ff9c6e4#ff7a455#fa541c6#d4380d7#ad21028#8714009#610b0010
orange
#fff7e61#ffe7ba2#ffd5913#ffc0694#ffa9405#fa8c166#d46b087#ad4e008#8738009#61250010
gold
#fffbe61#fff1b82#ffe58f3#ffd6664#ffc53d5#faad146#d488067#ad68008#874d009#61340010
yellow
#feffe61#ffffb82#fffb8f3#fff5664#ffec3d5#fadb146#d4b1067#ad8b008#8768009#61470010
lime
#fcffe61#f4ffb82#eaff8f3#d3f2614#bae6375#a0d9116#7cb3057#5b8c008#3f66009#25400010
green
#f6ffed1#d9f7be2#b7eb8f3#95de644#73d13d5#52c41a6#389e0d7#2378048#1352009#092b0010
cyan
#e6fffb1#b5f5ec2#87e8de3#5cdbd34#36cfc95#13c2c26#08979c7#006d758#00474f9#00232910
blue
#e6f4ff1#bae0ff2#91caff3#69b1ff4#4096ff5#1677ff6#0958d97#003eb38#002c8c9#001d6610
geekblue
#f0f5ff1#d6e4ff2#adc6ff3#85a5ff4#597ef75#2f54eb6#1d39c47#10239e8#0611789#03085210
purple
#f9f0ff1#efdbff2#d3adf73#b37feb4#9254de5#722ed16#531dab7#3910858#22075e9#12033810
magenta
#fff0f61#ffd6e72#ffadd23#ff85c04#f759ab5#eb2f966#c41d7f7#9e10688#7806509#52033910
Colour roles and palettes
ColorPicker changes the primary colour; public tokens show semantic roles and twelve base palettes.
PaletteExample.svelte<script lang="ts"> import { Button, ColorPicker, ConfigProvider, theme } from '@woodger/antd'; import PaletteReadout from './PaletteReadout.svelte'; let { dark = false }: { dark?: boolean } = $props(); let primary = $state('#1677ff'); </script> <div class="controls"> <span id="design-primary-label">{("Palette primary colour")}</span> <ColorPicker aria-labelledby="design-primary-label" value={primary} showText disabledAlpha onChange={(_, css) => { primary = css; }} /> <Button onclick={() => { primary = '#1677ff'; }}>{("Reset palette colour")}</Button> </div> <ConfigProvider theme={{ ...(dark ? { mode: 'dark', algorithm: theme.darkAlgorithm } : {}), token: { colorPrimary: primary } }}> <PaletteReadout /> </ConfigProvider> <style> .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; } </style>PaletteReadout.svelte<script lang="ts"> import { theme } from '@woodger/antd'; const current = theme.useToken(); const colors = [ 'red', 'volcano', 'orange', 'gold', 'yellow', 'lime', 'green', 'cyan', 'blue', 'geekblue', 'purple', 'magenta' ] as const; const levels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as const; const roles = [ 'colorPrimaryBg', 'colorPrimaryBorder', 'colorPrimaryHover', 'colorPrimary', 'colorPrimaryActive', 'colorText', 'colorTextSecondary', 'colorBgContainer' ] as const; </script> <div class="surface"> <dl aria-label={("Semantic palette roles")}> {#each roles as role (role)} <div class="role"><dt>{role}</dt><dd><span class="swatch" style:background={current .token[role]} aria-hidden="true"></span><code>{current.token[role]}</code></dd></div> {/each} </dl> <div class="palettes" aria-label={("Base theme palettes")}> {#each colors as color (color)} <section aria-label={color}> <h4>{color}</h4> <ol> {#each levels as level (level)} <li><span class="swatch" style:background={current.token[`${color}${level}`]} aria-hidden="true" ></span><code>{current.token[`${color}${level}`]}</code><small>{level}</small></li> {/each} </ol> </section> {/each} </div> </div> <style> .surface { padding: 16px; background: var(--ant-color-bg-container); color: var(--ant-color-text); border-radius: 6px; } dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px 24px; margin: 0 0 24px; } dt { overflow-wrap: anywhere; font-size: 12px; } dd { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; } .palettes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 24px; } h4 { margin: 0 0 8px; font-size: 14px; font-weight: 500; } ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; } li { display: flex; align-items: center; gap: 8px; min-width: 0; } .swatch { flex: none; width: 24px; height: 20px; border: 1px solid var(--ant-color-border-secondary); border-radius: 3px; } code { font-size: 11px; overflow-wrap: anywhere; } small { margin-inline-start: auto; color: var(--ant-color-text-secondary); font-size: 11px; } </style>
Neutral colours
Text, surfaces, borders and dividers occupy most of a work interface. Their differences establish hierarchy without constant vivid accents. Opacity combines with the background to determine the result, so evaluate a colour on its actual surface rather than as an isolated sample.
Adapted from the guide by Ant Design. MIT.