I run a emacs daemon on boot as a OpenRC service without info about terminals. When I plug a different terminal on emacsclient so, I don't have env variables instead that was generated inside of emacs or defined on service config. Beyond that, I got different behaviors on face colors of my theme because on each terminal will have different color support. For instance, running emacsclient through the xfce4-terminal inside of a tmux session I got:

Plugging the same tmux session on uxterm or running without X, I got instead:

(is the same emacsclient session, so is the same frame for both because tmux)
My wish is: modify the frame face colors only if I don't have a good color support on terminal, which happens on my case with xterm on running without X (console mode C-M-F{1,9}). I want do that because the face background colors for helm-selection and region is just black (I can't see they on xterm and this is pretty bad for usage).
For now I'm just change the face colors on frame creation for non-X sessions to red, like terminal sessions through this function: setup-terminal-session. But this change even the behavior inside of xfce4-terminal (which runs pretty fine because the good color support) and is unecessary.
Maybe I can fix the behavior of xterm forcing a type of color support on config through .Xdefaults or .Xresources file, but and the case of running emacs without X? I don't have full color support on that. So seems a kind of limitation here on a simple thing.
Anyway, my question is (again): there is a way to detect the color support of terminal inside of emacsclient without relying on ENV variables? I just don't understand how termcap and terminfo works reading the docs, would be nice a clarification on that. Thanks.
tmuxa 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.tty-color.elcommentary, and the varioustty-*functions and variables.tmuxon my setup are forcingTERMto bexterm-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 withTERM=xterm-256I cannot see gray colors onxterm... I don't understand that. And don't setting for tmux that, neitherxfce4-terminalworks 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.