Skip to content

VGA Colors#

What are VGA Colors?#

The VGA palette is based on a 8-bit color space of 216 colors and 24 shades of gray. 256 color options in total.

Disclaimer

Not all terminals support 8-bit VGA colors. If your terminal does support such advanced colors, read on.

Full Line Text Functions#

Try the vga() and bg_vga() methods for a full line of colored text. The value can be an integer between 0-255.

Example:

Python
1
2
3
4
from colorist import vga, bg_vga

vga("I want this text in purple VGA colors", 57)
bg_vga("I want this background in purple VGA colors", 57)

How it appears in the terminal:

% I want this text in purple VGA colors
% I want this background in purple VGA colors

Custom String Styling#

Or customize the styling of text and background with the ColorVGA() and BgColorVGA() classes:

Python
1
2
3
4
5
6
7
from colorist import ColorVGA, BgColorVGA

honey_yellow = ColorVGA(220)
bg_navy_blue = BgColorVGA(19)

print(f"I want to use {honey_yellow}honey yellow{honey_yellow.OFF}...")
print(f"... and {bg_steel_blue}navy blue{bg_steel_blue.OFF} colors")

How it appears in the terminal:

% I want to use honey yellow...
% ... and navy blue colors

Palette Options and Color Maps#

Standard Colors#

 0   1   2   3   4   5   6   7 
 8   9  10 11 12 13 14 15

Extended Colors#

16 22 28 34 40 46 82 76 70 64 58 52
17 23 29 35 41 47 83 77 71 65 59 53
18 24 30 36 42 48 84 78 72 66 60 54
19 25 31 37 43 49 85 79 73 67 61 55
20 26 32 38 44 50 86 80 74 68 62 56
21 27 33 39 45 51 87 81 75 69 63 57
93 99 105 111 117 123 159 153 147 141 135 129
92 98 104 110 116 122 158 152 146 140 134 128
91 97 103 109 115 121 157 151 145 139 133 127
90 96 102 108 114 120 156 150 144 138 132 126
89 95 101 107 113 119 155 149 143 137 131 125
88 94 100 106 112 118 154 148 142 136 130 124
160 166 172 178 184 190 226 220 214 208 202 196
161 167 173 179 185 191 227 221 215 209 203 197
162 168 174 180 186 192 228 222 216 210 204 198
163 169 175 181 187 193 229 223 217 211 205 199
164 170 176 182 188 194 230 224 218 212 206 200
165 171 177 183 189 195 231 225 219 213 207 201

Gray Scale#

232 233 234 235 236 237 238 239 240 241 242 243
255 254 253 252 251 250 249 248 247 246 245 244