The Secure Shell Chrome App combined with a remote Linux box, screen and emacs is a game-changer. Among other things, it turns my Chromebook into a programmer friendly hacking environment.
One quirk of this combination is that the color scheme emacs loaded by default was often illegible. I'd typically run M-x customize-themes to pick a better color scheme, but no matter the theme I selected the colors were always harsh and often left text hard to read.
Turns out, there's a quick fix to this issue. The problem and its fix is described here. It boils down to this: the Secure Shell App sets the terminal type to xterm-256color. Emacs supports this terminal type, granting it access to, well, 256 colors. But I'm running screen, and screen morphs that terminal type to screen.term-256color. Emacs doesn't know what to make of this terminal type so it falls back to to 8 color mode.
This becomes clear when I ran M-x list-colors-display.
The following tells emacs that screen's terminal type is one that it knows:
(add-to-list 'term-file-aliases '("screen.xterm-256color" . "xterm-256color"))
I added this code to my init.el, restarted and suddenly got access to 256 colors.
Now the default emacs color choices make sense. Such a simple fix, and I didn't even realize I had this problem.
Your code is focused on web stuff, mine was purely terminal focused:
ReplyDeleteshow_all_attr_colors256_verbose ()
{
local display_text="${1:-Lorem ipsum dolor sit amet}";
local -A layer;
local -A attrib;
attrib+=([0]=normal);
attrib+=([1]=bold);
attrib+=([2]=faint);
attrib+=([3]=italic);
attrib+=([4]=underline);
attrib+=([5]=blink);
attrib+=([7]=reverse);
layer+=([38\;5]=foreground);
layer+=([48\;5]=background);
local attr;
local fgbg;
local color;
for attr in 0 1 2 3 4 5 7;
do
for fgbg in 38\;5 48\;5;
do
for color in {0..255};
do
printf "%s %s color%03d: \E[%s;%s;%sm%s\E[0m\n" "${attrib[${attr}]}" "${layer[${fgbg}]}" "${color}" "${attr}" "${fgbg}" "${color}" "${display_text}";
done;
done;
done
}
Intented to be used with fzf:
show_all_attr_colors256_verbose | fzf --ansi