Colours reference
TAnsiColor is a value-type record describing a foreground or background colour. Build them by name, by 256-palette index, by RGB, or by hex.
Building colours
// Named — the 16 ANSI colours plus the full xterm-256 palette
TAnsiColor.Red
TAnsiColor.Aqua
TAnsiColor.Lime
TAnsiColor.Cyan2
TAnsiColor.Grey
// 256-palette index (0-255)
TAnsiColor.FromIndex(202)
// 24-bit RGB
TAnsiColor.FromRGB(255, 136, 0)
// Hex
TAnsiColor.FromHex('#ff8800')
TAnsiColor.FromHex('ff8800') // # is optional
// By name (case-insensitive; aliases like gray/grey, magenta/fuchsia,
// cyan/aqua all resolve)
TAnsiColor.FromName('orange1')A zero-initialised TAnsiColor (no constructor call) means default — "use the terminal's default for this slot". IsDefault returns True.
In markup
The same names work as markup tokens (lowercase by convention):
[red]hi[/]
[bold cyan2]hi[/]
[#ff8800 on #1e90ff]warm on cool[/]The 16 ANSI base colours
Always available, regardless of terminal capability. Indices 0–15 map directly to the SGR fg/bg codes:
| # | Swatch | Name | Hex | SGR fg | SGR bg |
|---|---|---|---|---|---|
| 0 | black | black | #000000 | 30 | 40 |
| 1 | maroon | maroon | #800000 | 31 | 41 |
| 2 | green | green | #008000 | 32 | 42 |
| 3 | olive | olive | #808000 | 33 | 43 |
| 4 | navy | navy | #000080 | 34 | 44 |
| 5 | purple | purple | #800080 | 35 | 45 |
| 6 | teal | teal | #008080 | 36 | 46 |
| 7 | silver | silver | #c0c0c0 | 37 | 47 |
| 8 | grey | grey / gray | #808080 | 90 | 100 |
| 9 | red | red | #ff0000 | 91 | 101 |
| 10 | lime | lime | #00ff00 | 92 | 102 |
| 11 | yellow | yellow | #ffff00 | 93 | 103 |
| 12 | blue | blue | #0000ff | 94 | 104 |
| 13 | fuchsia | fuchsia / magenta | #ff00ff | 95 | 105 |
| 14 | aqua | aqua / cyan | #00ffff | 96 | 106 |
| 15 | white | white | #ffffff | 97 | 107 |
Grey, Fuchsia and Aqua each have a CSS-style alias (Gray, Magenta, Cyan) that resolves to the same palette entry.
The full xterm-256 palette
Indices 0–15 are the standard ANSI colours above, repeated here for completeness. 16–231 form a 6×6×6 RGB cube using levels (0, 95, 135, 175, 215, 255). 232–255 are the 24-step grayscale ramp 8 + (i − 232) × 10. Names are taken verbatim from Spectre.Console's generated palette so call sites match between the two libraries; the trailing _1, _2 suffixes mark repeated palette positions.
| # | Swatch | Name | Hex |
|---|---|---|---|
| 0 | black | black | #000000 |
| 1 | maroon | maroon | #800000 |
| 2 | green | green | #008000 |
| 3 | olive | olive | #808000 |
| 4 | navy | navy | #000080 |
| 5 | purple | purple | #800080 |
| 6 | teal | teal | #008080 |
| 7 | silver | silver | #c0c0c0 |
| 8 | grey | grey / gray | #808080 |
| 9 | red | red | #ff0000 |
| 10 | lime | lime | #00ff00 |
| 11 | yellow | yellow | #ffff00 |
| 12 | blue | blue | #0000ff |
| 13 | fuchsia | fuchsia / magenta | #ff00ff |
| 14 | aqua | aqua / cyan | #00ffff |
| 15 | white | white | #ffffff |
| 16 | grey0 | grey0 / gray0 | #000000 |
| 17 | navyblue | navyblue | #00005f |
| 18 | darkblue | darkblue | #000087 |
| 19 | blue3 | blue3 | #0000af |
| 20 | blue3_1 | blue3_1 | #0000d7 |
| 21 | blue1 | blue1 | #0000ff |
| 22 | darkgreen | darkgreen | #005f00 |
| 23 | deepskyblue4 | deepskyblue4 | #005f5f |
| 24 | deepskyblue4_1 | deepskyblue4_1 | #005f87 |
| 25 | deepskyblue4_2 | deepskyblue4_2 | #005faf |
| 26 | dodgerblue3 | dodgerblue3 | #005fd7 |
| 27 | dodgerblue2 | dodgerblue2 | #005fff |
| 28 | green4 | green4 | #008700 |
| 29 | springgreen4 | springgreen4 | #00875f |
| 30 | turquoise4 | turquoise4 | #008787 |
| 31 | deepskyblue3 | deepskyblue3 | #0087af |
| 32 | deepskyblue3_1 | deepskyblue3_1 | #0087d7 |
| 33 | dodgerblue1 | dodgerblue1 | #0087ff |
| 34 | green3 | green3 | #00af00 |
| 35 | springgreen3 | springgreen3 | #00af5f |
| 36 | darkcyan | darkcyan | #00af87 |
| 37 | lightseagreen | lightseagreen | #00afaf |
| 38 | deepskyblue2 | deepskyblue2 | #00afd7 |
| 39 | deepskyblue1 | deepskyblue1 | #00afff |
| 40 | green3_1 | green3_1 | #00d700 |
| 41 | springgreen3_1 | springgreen3_1 | #00d75f |
| 42 | springgreen2 | springgreen2 | #00d787 |
| 43 | cyan3 | cyan3 | #00d7af |
| 44 | darkturquoise | darkturquoise | #00d7d7 |
| 45 | turquoise2 | turquoise2 | #00d7ff |
| 46 | green1 | green1 | #00ff00 |
| 47 | springgreen2_1 | springgreen2_1 | #00ff5f |
| 48 | springgreen1 | springgreen1 | #00ff87 |
| 49 | mediumspringgreen | mediumspringgreen | #00ffaf |
| 50 | cyan2 | cyan2 | #00ffd7 |
| 51 | cyan1 | cyan1 | #00ffff |
| 52 | darkred | darkred | #5f0000 |
| 53 | deeppink4 | deeppink4 | #5f005f |
| 54 | purple4 | purple4 | #5f0087 |
| 55 | purple4_1 | purple4_1 | #5f00af |
| 56 | purple3 | purple3 | #5f00d7 |
| 57 | blueviolet | blueviolet | #5f00ff |
| 58 | orange4 | orange4 | #5f5f00 |
| 59 | grey37 | grey37 / gray37 | #5f5f5f |
| 60 | mediumpurple4 | mediumpurple4 | #5f5f87 |
| 61 | slateblue3 | slateblue3 | #5f5faf |
| 62 | slateblue3_1 | slateblue3_1 | #5f5fd7 |
| 63 | royalblue1 | royalblue1 | #5f5fff |
| 64 | chartreuse4 | chartreuse4 | #5f8700 |
| 65 | darkseagreen4 | darkseagreen4 | #5f875f |
| 66 | paleturquoise4 | paleturquoise4 | #5f8787 |
| 67 | steelblue | steelblue | #5f87af |
| 68 | steelblue3 | steelblue3 | #5f87d7 |
| 69 | cornflowerblue | cornflowerblue | #5f87ff |
| 70 | chartreuse3 | chartreuse3 | #5faf00 |
| 71 | darkseagreen4_1 | darkseagreen4_1 | #5faf5f |
| 72 | cadetblue | cadetblue | #5faf87 |
| 73 | cadetblue_1 | cadetblue_1 | #5fafaf |
| 74 | skyblue3 | skyblue3 | #5fafd7 |
| 75 | steelblue1 | steelblue1 | #5fafff |
| 76 | chartreuse3_1 | chartreuse3_1 | #5fd700 |
| 77 | palegreen3 | palegreen3 | #5fd75f |
| 78 | seagreen3 | seagreen3 | #5fd787 |
| 79 | aquamarine3 | aquamarine3 | #5fd7af |
| 80 | mediumturquoise | mediumturquoise | #5fd7d7 |
| 81 | steelblue1_1 | steelblue1_1 | #5fd7ff |
| 82 | chartreuse2 | chartreuse2 | #5fff00 |
| 83 | seagreen2 | seagreen2 | #5fff5f |
| 84 | seagreen1 | seagreen1 | #5fff87 |
| 85 | seagreen1_1 | seagreen1_1 | #5fffaf |
| 86 | aquamarine1 | aquamarine1 | #5fffd7 |
| 87 | darkslategray2 | darkslategray2 | #5fffff |
| 88 | darkred_1 | darkred_1 | #870000 |
| 89 | deeppink4_1 | deeppink4_1 | #87005f |
| 90 | darkmagenta | darkmagenta | #870087 |
| 91 | darkmagenta_1 | darkmagenta_1 | #8700af |
| 92 | darkviolet | darkviolet | #8700d7 |
| 93 | purple_1 | purple_1 | #8700ff |
| 94 | orange4_1 | orange4_1 | #875f00 |
| 95 | lightpink4 | lightpink4 | #875f5f |
| 96 | plum4 | plum4 | #875f87 |
| 97 | mediumpurple3 | mediumpurple3 | #875faf |
| 98 | mediumpurple3_1 | mediumpurple3_1 | #875fd7 |
| 99 | slateblue1 | slateblue1 | #875fff |
| 100 | yellow4 | yellow4 | #878700 |
| 101 | wheat4 | wheat4 | #87875f |
| 102 | grey53 | grey53 / gray53 | #878787 |
| 103 | lightslategrey | lightslategrey / lightslategray | #8787af |
| 104 | mediumpurple | mediumpurple | #8787d7 |
| 105 | lightslateblue | lightslateblue | #8787ff |
| 106 | yellow4_1 | yellow4_1 | #87af00 |
| 107 | darkolivegreen3 | darkolivegreen3 | #87af5f |
| 108 | darkseagreen | darkseagreen | #87af87 |
| 109 | lightskyblue3 | lightskyblue3 | #87afaf |
| 110 | lightskyblue3_1 | lightskyblue3_1 | #87afd7 |
| 111 | skyblue2 | skyblue2 | #87afff |
| 112 | chartreuse2_1 | chartreuse2_1 | #87d700 |
| 113 | darkolivegreen3_1 | darkolivegreen3_1 | #87d75f |
| 114 | palegreen3_1 | palegreen3_1 | #87d787 |
| 115 | darkseagreen3 | darkseagreen3 | #87d7af |
| 116 | darkslategray3 | darkslategray3 | #87d7d7 |
| 117 | skyblue1 | skyblue1 | #87d7ff |
| 118 | chartreuse1 | chartreuse1 | #87ff00 |
| 119 | lightgreen | lightgreen | #87ff5f |
| 120 | lightgreen_1 | lightgreen_1 | #87ff87 |
| 121 | palegreen1 | palegreen1 | #87ffaf |
| 122 | aquamarine1_1 | aquamarine1_1 | #87ffd7 |
| 123 | darkslategray1 | darkslategray1 | #87ffff |
| 124 | red3 | red3 | #af0000 |
| 125 | deeppink4_2 | deeppink4_2 | #af005f |
| 126 | mediumvioletred | mediumvioletred | #af0087 |
| 127 | magenta3 | magenta3 | #af00af |
| 128 | darkviolet_1 | darkviolet_1 | #af00d7 |
| 129 | purple_2 | purple_2 | #af00ff |
| 130 | darkorange3 | darkorange3 | #af5f00 |
| 131 | indianred | indianred | #af5f5f |
| 132 | hotpink3 | hotpink3 | #af5f87 |
| 133 | mediumorchid3 | mediumorchid3 | #af5faf |
| 134 | mediumorchid | mediumorchid | #af5fd7 |
| 135 | mediumpurple2 | mediumpurple2 | #af5fff |
| 136 | darkgoldenrod | darkgoldenrod | #af8700 |
| 137 | lightsalmon3 | lightsalmon3 | #af875f |
| 138 | rosybrown | rosybrown | #af8787 |
| 139 | grey63 | grey63 / gray63 | #af87af |
| 140 | mediumpurple2_1 | mediumpurple2_1 | #af87d7 |
| 141 | mediumpurple1 | mediumpurple1 | #af87ff |
| 142 | gold3 | gold3 | #afaf00 |
| 143 | darkkhaki | darkkhaki | #afaf5f |
| 144 | navajowhite3 | navajowhite3 | #afaf87 |
| 145 | grey69 | grey69 / gray69 | #afafaf |
| 146 | lightsteelblue3 | lightsteelblue3 | #afafd7 |
| 147 | lightsteelblue | lightsteelblue | #afafff |
| 148 | yellow3 | yellow3 | #afd700 |
| 149 | darkolivegreen3_2 | darkolivegreen3_2 | #afd75f |
| 150 | darkseagreen3_1 | darkseagreen3_1 | #afd787 |
| 151 | darkseagreen2 | darkseagreen2 | #afd7af |
| 152 | lightcyan3 | lightcyan3 | #afd7d7 |
| 153 | lightskyblue1 | lightskyblue1 | #afd7ff |
| 154 | greenyellow | greenyellow | #afff00 |
| 155 | darkolivegreen2 | darkolivegreen2 | #afff5f |
| 156 | palegreen1_1 | palegreen1_1 | #afff87 |
| 157 | darkseagreen2_1 | darkseagreen2_1 | #afffaf |
| 158 | darkseagreen1 | darkseagreen1 | #afffd7 |
| 159 | paleturquoise1 | paleturquoise1 | #afffff |
| 160 | red3_1 | red3_1 | #d70000 |
| 161 | deeppink3 | deeppink3 | #d7005f |
| 162 | deeppink3_1 | deeppink3_1 | #d70087 |
| 163 | magenta3_1 | magenta3_1 | #d700af |
| 164 | magenta3_2 | magenta3_2 | #d700d7 |
| 165 | magenta2 | magenta2 | #d700ff |
| 166 | darkorange3_1 | darkorange3_1 | #d75f00 |
| 167 | indianred_1 | indianred_1 | #d75f5f |
| 168 | hotpink3_1 | hotpink3_1 | #d75f87 |
| 169 | hotpink2 | hotpink2 | #d75faf |
| 170 | orchid | orchid | #d75fd7 |
| 171 | mediumorchid1 | mediumorchid1 | #d75fff |
| 172 | orange3 | orange3 | #d78700 |
| 173 | lightsalmon3_1 | lightsalmon3_1 | #d7875f |
| 174 | lightpink3 | lightpink3 | #d78787 |
| 175 | pink3 | pink3 | #d787af |
| 176 | plum3 | plum3 | #d787d7 |
| 177 | violet | violet | #d787ff |
| 178 | gold3_1 | gold3_1 | #d7af00 |
| 179 | lightgoldenrod3 | lightgoldenrod3 | #d7af5f |
| 180 | tan | tan | #d7af87 |
| 181 | mistyrose3 | mistyrose3 | #d7afaf |
| 182 | thistle3 | thistle3 | #d7afd7 |
| 183 | plum2 | plum2 | #d7afff |
| 184 | yellow3_1 | yellow3_1 | #d7d700 |
| 185 | khaki3 | khaki3 | #d7d75f |
| 186 | lightgoldenrod2 | lightgoldenrod2 | #d7d787 |
| 187 | lightyellow3 | lightyellow3 | #d7d7af |
| 188 | grey84 | grey84 / gray84 | #d7d7d7 |
| 189 | lightsteelblue1 | lightsteelblue1 | #d7d7ff |
| 190 | yellow2 | yellow2 | #d7ff00 |
| 191 | darkolivegreen1 | darkolivegreen1 | #d7ff5f |
| 192 | darkolivegreen1_1 | darkolivegreen1_1 | #d7ff87 |
| 193 | darkseagreen1_1 | darkseagreen1_1 | #d7ffaf |
| 194 | honeydew2 | honeydew2 | #d7ffd7 |
| 195 | lightcyan1 | lightcyan1 | #d7ffff |
| 196 | red1 | red1 | #ff0000 |
| 197 | deeppink2 | deeppink2 | #ff005f |
| 198 | deeppink1 | deeppink1 | #ff0087 |
| 199 | deeppink1_1 | deeppink1_1 | #ff00af |
| 200 | magenta2_1 | magenta2_1 | #ff00d7 |
| 201 | magenta1 | magenta1 | #ff00ff |
| 202 | orangered1 | orangered1 | #ff5f00 |
| 203 | indianred1 | indianred1 | #ff5f5f |
| 204 | indianred1_1 | indianred1_1 | #ff5f87 |
| 205 | hotpink | hotpink | #ff5faf |
| 206 | hotpink_1 | hotpink_1 | #ff5fd7 |
| 207 | mediumorchid1_1 | mediumorchid1_1 | #ff5fff |
| 208 | darkorange | darkorange | #ff8700 |
| 209 | salmon1 | salmon1 | #ff875f |
| 210 | lightcoral | lightcoral | #ff8787 |
| 211 | palevioletred1 | palevioletred1 | #ff87af |
| 212 | orchid2 | orchid2 | #ff87d7 |
| 213 | orchid1 | orchid1 | #ff87ff |
| 214 | orange1 | orange1 | #ffaf00 |
| 215 | sandybrown | sandybrown | #ffaf5f |
| 216 | lightsalmon1 | lightsalmon1 | #ffaf87 |
| 217 | lightpink1 | lightpink1 | #ffafaf |
| 218 | pink1 | pink1 | #ffafd7 |
| 219 | plum1 | plum1 | #ffafff |
| 220 | gold1 | gold1 | #ffd700 |
| 221 | lightgoldenrod2_1 | lightgoldenrod2_1 | #ffd75f |
| 222 | lightgoldenrod2_2 | lightgoldenrod2_2 | #ffd787 |
| 223 | navajowhite1 | navajowhite1 | #ffd7af |
| 224 | mistyrose1 | mistyrose1 | #ffd7d7 |
| 225 | thistle1 | thistle1 | #ffd7ff |
| 226 | yellow1 | yellow1 | #ffff00 |
| 227 | lightgoldenrod1 | lightgoldenrod1 | #ffff5f |
| 228 | khaki1 | khaki1 | #ffff87 |
| 229 | wheat1 | wheat1 | #ffffaf |
| 230 | cornsilk1 | cornsilk1 | #ffffd7 |
| 231 | grey100 | grey100 / gray100 | #ffffff |
| 232 | grey3 | grey3 / gray3 | #080808 |
| 233 | grey7 | grey7 / gray7 | #121212 |
| 234 | grey11 | grey11 / gray11 | #1c1c1c |
| 235 | grey15 | grey15 / gray15 | #262626 |
| 236 | grey19 | grey19 / gray19 | #303030 |
| 237 | grey23 | grey23 / gray23 | #3a3a3a |
| 238 | grey27 | grey27 / gray27 | #444444 |
| 239 | grey30 | grey30 / gray30 | #4e4e4e |
| 240 | grey35 | grey35 / gray35 | #585858 |
| 241 | grey39 | grey39 / gray39 | #626262 |
| 242 | grey42 | grey42 / gray42 | #6c6c6c |
| 243 | grey46 | grey46 / gray46 | #767676 |
| 244 | grey50 | grey50 / gray50 | #808080 |
| 245 | grey54 | grey54 / gray54 | #8a8a8a |
| 246 | grey58 | grey58 / gray58 | #949494 |
| 247 | grey62 | grey62 / gray62 | #9e9e9e |
| 248 | grey66 | grey66 / gray66 | #a8a8a8 |
| 249 | grey70 | grey70 / gray70 | #b2b2b2 |
| 250 | grey74 | grey74 / gray74 | #bcbcbc |
| 251 | grey78 | grey78 / gray78 | #c6c6c6 |
| 252 | grey82 | grey82 / gray82 | #d0d0d0 |
| 253 | grey85 | grey85 / gray85 | #dadada |
| 254 | grey89 | grey89 / gray89 | #e4e4e4 |
| 255 | grey93 | grey93 / gray93 | #eeeeee |
Capability-aware downsampling
The active console's Profile.Capabilities.ColorSystem determines how a TAnsiColor actually emits:
TColorSystem | What's emitted |
|---|---|
NoColors | Nothing. SGR escapes are stripped. |
Legacy | 8 colours (SGR 30-37 / 40-47); brights downsampled. |
Standard | 16 colours (adds SGR 90-97 / 100-107). |
EightBit | 256 colours (38;5;n / 48;5;n). |
TrueColor | 24-bit RGB (38;2;r;g;b / 48;2;r;g;b). |
A TAnsiColor.FromRGB value renders perfectly under TrueColor, gracefully downsamples to the nearest 256 entry under EightBit, and further to the closest of 16 / 8 colours under Standard / Legacy. You get colour where it's supported and clean text where it isn't.
See Capabilities for how the colour system is detected.
Helpers
// Blend two colours by a 0..1 fade factor — used by the indeterminate
// progress bar pulse.
mid := TAnsiColor.Red.Blend(TAnsiColor.Yellow, 0.5);
// Compare two colours for equality
if c1.Equals(c2) then ...
// Render to debug-friendly string
s := c.ToString; // e.g. 'rgb(255,136,0)' or '#ff8800'See also
- Markup syntax — using colours inside markup tags.
- Styles — combining colours with decorations into a
TAnsiStyle. - Capabilities — colour-system detection.
- Canvas — for pixel-level RGB rendering.