termstandard / colors

Color standards for terminal emulators
The Unlicense
1.1k stars 44 forks source link

"ANSI" has never defined "16 colors" #19

Open craigbarnes opened 5 years ago

craigbarnes commented 5 years ago

The readme states:

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)

...but the ANSI X3.64 spec has never defined "16 colors" -- it defines 8 colors, which can be applied to the foreground and/or background. The extra 8 "bright" colors are an aixterm thing (which were later adopted by xterm) and aren't mentioned anywhere in the ANSI spec.

It seems odd to say "there exists common confusion about terminal colors" and then follow it with more confusion.

XVilka commented 5 years ago

Thanks! I will check and correct both repo and gist.

craigbarnes commented 5 years ago

If you update the readme, I don't think the aixterm colors are worth mentioning. Many apps just use the xterm escape sequences (e.g. \033[38;5;9m) for colors 8-15 instead of the original aixterm ones (e.g. \033[91m). The best fix is probably to just change it to:

ANSI escape codes: 16 8 color codes with bold/italic and background

Edit: although I guess the + 16 ANSI in the third bullet point needs changing too.

kurahaupo commented 1 year ago

If we're going to split "16 colour ANSI" into "8 colour ANSI" plus "16 colour common extension to ANSI", then strictly speaking after "Plain ASCII" we should add