Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I actually have the opposite problem. I’d like to limit terminal apps to just the 16 colours I have defined in my terminal settings (which is actually 3 colours in my case), but some apps (like the rust compiler e.g.) emit escape sequences which slightly change the shade in some places, in 256 colour space. I’d like to disable those 256 colours and limit everything to 16. I don’t think I can though.


I think you can set how the terminal presents itself in both tmux and regular Terminal.app

If the app doesn’t check for support and simply spills the control characters, there may be garbled output.


I've tried switching this setting in Terminal.app and all it seems to do is change the value of the TERM environment variable. I haven't observed any other effect.


It’s that value that apps should check. I know vim does.


As a rust programmer, you can explain to us where in this source code the rust compiler is emitting these escape sequences for colours outwith the AIXTerm 16 colour set.

* https://github.com/rust-lang/rust/blob/master/compiler/rustc...


I don't see it here, but one example would be help messages saying "consider introducing lifetime `'bla` here", which are preceded with a source code quote saying something like:

  fn foo<'bla>(...)
According to cat -v, <'bla> is preceded by ^[[38;5;10m, which, according to [1], "applies extended color value to the foreground", and further that 38;5;<s> sets "foreground color to <s> index in 88 or 256 color table".

[1]: <https://learn.microsoft.com/en-us/windows/console/console-vi...>


Oh dear. You will I hope not be too embarrassed by learning that the 10 in SGR 38;5;10 (that control sequence) is colour index 10, which is less than 16, and a member of the very AIXTerm 16 colour set that you want. Thus the rust compiler is not in fact using a colour outwith the 16 AIXTerm colours.


Then I don't know how it happens, because I only have yellowish background + black and red defined in my terminal (also white, which I don't see used anywhere). And here is a screenshot from my Terminal.app, where the lifetime is gray: <https://0x0.st/HqVq.32.png>.

I've checked and the 10th colour is set to #000000 in my Terminal.app settings.


If SGR 38;5;10 is not producing green, which it isn't, then it must be following your palette. My educated guess is that for some reason it believes that it should lighten the palette-specified colours from 8 to 15, and it's lightening your black to a very dark grey.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: