CSS/HTML 支援 147 種標準命名顏色(CSS Color Module Level 4),外加十六進位、RGB、HSL 多種表示法。本文提供完整對照表、命名規則、透明度語法與設計系統應用建議。
紅/粉/橙系:Red, Crimson, FireBrick, DarkRed, Maroon, Tomato, OrangeRed, Coral, LightCoral, Salmon, DarkSalmon, LightSalmon, Orange, DarkOrange, Gold, Yellow, LightYellow, LemonChiffon, PapayaWhip, PeachPuff, Moccasin, Bisque, BlanchedAlmond, NavajoWhite, Wheat, SandyBrown, Peru, Chocolate, SaddleBrown, Sienna, Brown, Maroon
綠/青/藍綠系:Green, Lime, LimeGreen, ForestGreen, SeaGreen, MediumSeaGreen, DarkGreen, Olive, OliveDrab, DarkOliveGreen, YellowGreen, LawnGreen, Chartreuse, GreenYellow, SpringGreen, MediumSpringGreen, LightGreen, PaleGreen, DarkSeaGreen, MediumAquamarine, Aquamarine, Turquoise, LightSeaGreen, MediumTurquoise, DarkTurquoise, Teal, DarkCyan, Cyan, Aqua, PaleTurquoise, LightCyan
藍/紫/靛系:Blue, MediumBlue, DarkBlue, Navy, MidnightBlue, RoyalBlue, CornflowerBlue, DodgerBlue, DeepSkyBlue, SkyBlue, LightSkyBlue, SteelBlue, LightSteelBlue, SlateBlue, MediumSlateBlue, MediumPurple, BlueViolet, Indigo, DarkSlateBlue, DarkViolet, DarkOrchid, MediumOrchid, Purple, DarkMagenta, Magenta, Fuchsia, Violet, Orchid, Plum, Thistle, Lavender
白/灰/黑系:White, Snow, GhostWhite, WhiteSmoke, Gainsboro, LightGray, Silver, DarkGray, Gray, DimGray, Black
暖棕/米/奶茶系:Beige, AntiqueWhite, FloralWhite, Ivory, Linen, OldLace, Cornsilk, Seashell, MistyRose, LavenderBlush
| 顏色名 | HEX | RGB | HSL |
|---|---|---|---|
| Red | #FF0000 | rgb(255,0,0) | hsl(0, 100%, 50%) |
| Lime | #00FF00 | rgb(0,255,0) | hsl(120, 100%, 50%) |
| Blue | #0000FF | rgb(0,0,255) | hsl(240, 100%, 50%) |
| Gold | #FFD700 | rgb(255,215,0) | hsl(51, 100%, 50%) |
| DeepSkyBlue | #00BFFF | rgb(0,191,255) | hsl(195, 100%, 50%) |
| Tomato | #FF6347 | rgb(255,99,71) | hsl(9, 100%, 64%) |
| MediumSeaGreen | #3CB371 | rgb(60,179,113) | hsl(146, 50%, 47%) |
| SlateBlue | #6A5ACD | rgb(106,90,205) | hsl(248, 53%, 58%) |
| Crimson | #DC143C | rgb(220,20,60) | hsl(348, 83%, 47%) |
| HotPink | #FF69B4 | rgb(255,105,180) | hsl(330, 100%, 71%) |
/* RGB + Alpha */
color: rgba(255, 0, 0, 0.5); /* 50% 透明紅 */
background: rgb(255 0 0 / 50%); /* CSS Color Level 4 空格語法 */
/* HSL + Alpha */
color: hsla(0, 100%, 50%, 0.3);
background: hsl(0 100% 50% / 30%);
/* HEX + Alpha(8 位元) */
color: #FF000080; /* #RRGGBBAA,AA=80(16進位)=128(10進位)≈50% */
background: #00FF00CC; /* 綠色 80% 不透明 */
/* 關鍵字 transparent */
border-color: transparent;
.icon { color: #0066CC; }
.icon svg { fill: currentColor; } /* SVG 圖示跟隨文字色 */
.icon::before { border-color: currentColor; } /* 邊框跟隨文字色 */
:root {
/* 品牌色 */
--color-primary: #2563EB; /* Blue-600 */
--color-primary-hover: #1D4ED8; /* Blue-700 */
--color-primary-light: #DBEAFE; /* Blue-50 */
/* 語意色 */
--color-success: #059669; /* Emerald-600 */
--color-warning: #D97706; /* Amber-600 */
--color-danger: #DC2626; /* Red-600 */
--color-info: #0891B2; /* Cyan-600 */
/* 中性色 */
--color-bg: #FFFFFF;
--color-bg-muted: #F9FAFB;
--color-border: #E5E7EB;
--color-text: #111827;
--color-text-muted: #6B7280;
}
/* 使用 */
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.alert-success { background: var(--color-success-light); border-color: var(--color-success); color: var(--color-success-dark); }
Color ContrastgetComputedStyle(el).color 取得實際渲染色值收藏這份對照表,命名顏色快速原型、HEX/RGB/HSL 精確控制、CSS 變數建立設計系統,三管齊下,色彩管理不再混亂。