Timeline for How to detect the term color support inside of a emacsclient session?
Current License: CC BY-SA 3.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 26, 2017 at 4:28 | vote | accept | Manoel Vilela | ||
| Oct 26, 2017 at 4:17 | answer | added | phils | timeline score: 3 | |
| Oct 26, 2017 at 3:07 | comment | added | Manoel Vilela | The problem was that tmux on my setup are forcing TERM to be xterm-256, so on inside of emacs (tty-display-colors-cells) seems that (again) that function rely on env variables, but at least I have that on terminal session. The mainly problem now is that even with TERM=xterm-256 I cannot see gray colors on xterm... I don't understand that. And don't setting for tmux that, neither xfce4-terminal works too. It's just a giant mess, hard to find someone to blame it. So the problem is on my setup and this question was answered. You should add (tty-display-color-cells) as answer. | |
| Oct 26, 2017 at 2:50 | comment | added | Manoel Vilela | FUCK! (sorry) is tmux fault. | |
| Oct 26, 2017 at 2:48 | comment | added | Manoel Vilela | But I don't get as (tty-display-color-cells) can have the same number of colors even running on different terminals which different behaviors... Seems that function is what I want, but doesn't works as I expected for some weird reason. tmux fault? | |
| Oct 26, 2017 at 2:45 | history | edited | Manoel Vilela | CC BY-SA 3.0 | added 2 characters in body |
| Oct 26, 2017 at 2:43 | comment | added | Manoel Vilela | Your idea with customize-face is pretty close what I want to do, but the problem is that both terminals are considered TTY :/, but I want to change only the one which don't have a good color support (like that terminals which cannot display gray colors and etc). I can set it for TTY and will not mess-up at least the gui sessions, but will change unnecessary the xfce4-terminal session which works fine. I mean.. I want to change the colors of the face helm-selection and region to red only for for terminals which doesn't display grays: xterm and console mode. | |
| Oct 26, 2017 at 2:35 | comment | added | Manoel Vilela | Well... for me the question is pretty straightfoward, how much colors the terminal on the emacsclient is running can represent, if is truecolor or not... sorry if seems confuse, but I don't get it. | |
| Oct 26, 2017 at 2:31 | comment | added | Manoel Vilela | (tty-display-color-cells) return the same number of colors on xfce4-terminal, uxterm and console mode on session without X. 256. So I think this is unrelated thing, or I'm doing something wrong? | |
| Oct 25, 2017 at 22:55 | comment | added | phils | Alternatively, maybe you are actually looking for the in-built M-x customize-face support for different display types? Select "For All Kinds of Display" on the "State" button, and then insert a new entry and select "specific display" on the "Display" button, and then select "Type" and "TTY" and other attributes as appropriate... | |
| Oct 25, 2017 at 22:47 | comment | added | phils | I really don't know what manner of "support" you are trying to detect, but I thought you would have found what you needed. e.g. (tty-display-color-cells) returns the number of colours available in a terminal-based frame. (tty-color-alist) similarly returns data on the actual colours. I presume they work as advertised. Perhaps you could update the question with what you are specifically looking for? | |
| Oct 25, 2017 at 21:34 | comment | added | Manoel Vilela | Unfortunately I don't found any particular useful thing for detecting color support on that file, sorry. Reading tty-color.el seems is a more a kind of color X simulation for tty related to color transformation, pretty unrelated to color support of terminals (though the misleading name). By another hand, this is file defined at term/tty-color.el, which directory term has a lot of scripts for supporting terminals. I saw interesting things on term/xterm.el, however they rely on env variables... so sad. Maybe I need change my approach, as that simple seems not possible. | |
| Oct 25, 2017 at 21:12 | comment | added | Manoel Vilela | Thanks for pointing that! The name give to me some hope. I'll look :) | |
| Oct 25, 2017 at 20:46 | comment | added | phils | Maybe have a look at the tty-color.el commentary, and the various tty-* functions and variables. | |
| Oct 25, 2017 at 9:31 | comment | added | Manoel Vilela | I know if I can fix the local frame variable will change the frame, so I'll change the behavior of the another tmux client which is attached to this same frame. But this not matter if at least I can detect the term color on frame creation (to decide or not change the theme) | |
| Oct 25, 2017 at 9:29 | comment | added | Manoel Vilela | I have the same problem using tmux or not. Using tmux on the example just happened because is pretty integrated on my personal setup. The problem remains not using tmux. I always used emacsclient without tmux and I had that problem before, now is not different. Tmux for me just keep things more easily, actually. Sorry if was confuse to you, but this is pretty unrelated to the problem :/ | |
| Oct 25, 2017 at 6:31 | comment | added | phils | Is tmux a necessary part of this set-up? I don't use it myself or know much about it, but it does seem like an added layer of complication here. Emacs has some terminal-local capabilities, but that tends to be tied to frames, and here you are sharing a single frame amongst multiple terminals. Given that you're using emacsclient anyhow, you might find that not using tmux is better. | |
| Oct 25, 2017 at 0:23 | history | edited | Manoel Vilela | CC BY-SA 3.0 | edited body |
| Oct 24, 2017 at 17:23 | history | asked | Manoel Vilela | CC BY-SA 3.0 |