Xterm: Difference between revisions

From miki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 27: Line 27:
xrdb ~/.Xresources
xrdb ~/.Xresources
</source>
</source>

== Enable 24-bit Truecolor support ==

There are '''lot''' of discussion about true color and italic support in the terminal. Below the list of relevant posts.

* [https://github.com/morhetz/gruvbox/wiki/Terminal-specific morhetz/gruvbox wiki -- Terminal specific]
* [https://github.com/neovim/neovim/wiki/FAQ neovim/neovim -- FAQ]
* [https://gist.github.com/XVilka/8346728 XVilka/TrueColour.md -- Colours in terminal]
* [http://bruinsslot.jp/2016/05/29/how-to-enable-true-color-for-neovim-tmux-and-gnome-terminal/ How to enable true-color for neovim, tmux, and gnome-terminal]
* [https://github.com/neovim/neovim/issues/3461 neovim/neovim -- Italics aren't displaying properly #3461]
* [https://github.com/neovim/neovim/issues/3462#issuecomment-148729580 neovim/neovim -- Get funny chars on terminal #3462]

All in all the solution for me involved to at least:
* Upgrade to Ubuntu Xenial 16.04, to get newest Gnome Terminal and Terminator/gtk3 on recent VTE.
* Upgrade to tmux 2.2 (only if using tmux).
* Do a total reset of the account configuration.
* Fiddle a bit with the terminfo (still not sure what was the exact recipe though).
* In Vim/Neovim, use ''gruvbox'' as theme (not ''solarized'', which does not work in terminal &mdash; ''now patched!'').

To test, first verify that the color theme works correctly in gvim.

=== Terminals ===
List of terminals that support 24-bit true colors:
* Gnome-Terminal
* Gnome-Terminator

=== Test true-color support ===
Run the script[https://gist.github.com/XVilka/8346728]:
<source lang=bash>
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
for (colnum = 0; colnum<77; colnum++) {
r = 255-(colnum*255/76);
g = (colnum*510/76);
b = (colnum*255/76);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum+1,1);
}
printf "\n";
}'
</source>

Or more:
* [https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/24-bit-color.sh 24-bit-color.sh]
* [https://raw.githubusercontent.com/robertknight/konsole/master/tests/color-spaces.pl color-spaces.pl]
* [https://git.gnome.org/browse/vte/tree/perf/img.sh?h=vte-0-36 A true color image viewer in terminal!]

Revision as of 10:04, 30 November 2016

References

Examples

Change the default window size:

  • Add/Edit this line to file ~/.Xdefaults:
 xterm*vt100.geometry:150x50+100+100
  • Merge it in X database:
 % xrdb -merge ~/.Xdefaults
  • Configure xterm fonts, colors, size. Edit ~/.Xresources:
XTerm*foreground: rgb:00/00/00
XTerm*background: rgb:ff/ff/dd
Xterm*saveLines: 4096
xterm*faceName: DejaVu Sans Mono:size=12
xterm*VT100.geometry: 132x40
... then update X resource database:
xrdb ~/.Xresources

Enable 24-bit Truecolor support

There are lot of discussion about true color and italic support in the terminal. Below the list of relevant posts.

All in all the solution for me involved to at least:

  • Upgrade to Ubuntu Xenial 16.04, to get newest Gnome Terminal and Terminator/gtk3 on recent VTE.
  • Upgrade to tmux 2.2 (only if using tmux).
  • Do a total reset of the account configuration.
  • Fiddle a bit with the terminfo (still not sure what was the exact recipe though).
  • In Vim/Neovim, use gruvbox as theme (not solarized, which does not work in terminal — now patched!).

To test, first verify that the color theme works correctly in gvim.

Terminals

List of terminals that support 24-bit true colors:

  • Gnome-Terminal
  • Gnome-Terminator

Test true-color support

Run the script[1]:

awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'

Or more: