termstandard / colors

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

Why doesn't MacOS's built-in Terminal support true color? #41

Closed wendajiang closed 2 years ago

kurahaupo commented 2 years ago

Obviously Apple knows why they haven't done it, so you could ask them "why", but I expect that they'd say "that's commercially sensitive; please sign this NDA before we tell you the answer" - and then you couldn't post the answer here.

It's reasonable to suppose that the reason is simply "because Apple customers haven't been clamouring for it in sufficient numbers to make it worth their while".

You could also check whether Apple originally forked their built-in terminal from an open source project. If so, Apple has been actively dropping updates from any projects that have adopted GPLv3, and many projects have moved over the last decade.

georgalis commented 2 years ago

Works for me.

Normally I don't use the MacOS built-in terminal and keep the settings default.

If this doesn't work for you, https://github.com/termstandard/colors#checking-for-colorterm try setting xterm-256color in advanced preferences (I think I read this elsewhere in this discussion today), fail that, configuring your environment may work export xterm-256color? Yes, it is not COLORTERM=truecolor probably because Mac is BSD license based, while COLORTERM is probably a GNU convention. No need to get ruffled because the world is not converging, it's splintering, or rather, everyone is converging on their best solution, but we can all get along.

kurahaupo commented 2 years ago

There's been a progressive splintering of terminal capability info.

In the beginning there was just stty, which told you a few things like which bytes were sent by the enter and backspace keys, and which bytes had to be sent to move the cursor to the next tabstop or next line, and whether delays are needed in certain cases.

That was quickly followed by termcap, which would tell you how to move around a "glass teletype terminal" (what we later thought of as simply "a terminal", with information on a screen rather than on printed paper). Termcap grew and became unwieldy because attribute names were limited to two characters, and then entire thing had to fit into a small byte limit; but at least you could put the entire definition into the TERMCAP environment variable so that it would follow wherever you went.

Terminfo solved the size limit, and (arguably) gave capabilities more mnemonic names, but it lost the ability to carry the actual definition in an envvar and instead relied on sysops keeping the terminfo database uptodate on each computer. (It doesn't even give you the option to have your own personal terminfo database in your homedir.) But time sharing computers were few and well staffed, so that wasn't much of a problem back then.

At the same time, localization for "other" languages had become a big thing, and so we had $LANG to tell us (among other things) which "non ASCII" bytes printed which glyphs.

Unicode was emerging as a solution to the vast array of native languages. There was just one snag: its characters that were wider than 8 bits, and changing terminals from using bytes to 16-bit words was prohibitive. So UTF-8 was conceived on a placemat in a New Jersey diner in Sep 1992 (where Ken Thompson and Rob Pike were having dinner.)

Which was fine, except that the UTF-8 was made part of Locale, indicated by a suffix on $LANG, rather than part of Terminfo.

Most of this happened before Linus Torvalds had even started building his "toy 80386 kernel".

Somewhere along the way, Linux wisely added a utf8 flag in stty. It's a pity we aren't all just using that, instead of relying on LANG (or TERM).

Then much later we started to think about supporting more than 16 colours. It's probably worth noting that the "standard" (non-GNU) way to check (whether a terminal supports TrueColor) is to ask terminfo for the RGB capability. But then one discovers that there's no longer a single centralized database of terminfo entries that everyone subscribes to, so that (for example) when you ssh to a host run by someone else, they likely won't have the same terminfo database as you're accustomed to. Even the names for the terminal types now vary between different Linux distributions.

Enter COLORTERM. We solve the laggardliness of Terminfo distribution by entirely sidestepping it and splintering the management of terminal attributes even further.

kurahaupo commented 2 years ago

This isn't really a question that this project can answer