What 12 hex digits color codes in xfce terminal configuration means? - colors

Recently I set up my XFCE terminal to use the perfect palette of
Solarized using this prepared config.
All works fine (although midnight commander colors make me cry now) but one thing is really curious to me:
Why do color codes in xfce terminal settings contain 12 hex digits rather than 6? Like these one:
ColorPalette8=#d3d3d7d7cfcf
What does it mean? And how is it related to color codes specified on
official page

GTK uses 16 bits per colour channel, i.e. 4 hex digits. A colour value for GTK can be encoded as #rgb, #rrggbb or #rrrrggggbbbb.

Related

how to setting ncurses size by lines

I'm building a GO game with ncurses, in the game it is about 19 lines.
I want make ncurses adjust font size by size of the window to make it always display 19 lines.
How to do this in ncurses? Thanks
ncurses doesn't set the size of the terminal. If the terminal has at least 19 lines, you can set the LINES environment variable, to tell ncurses to use only the first 19 lines of the screen (but expect some clearing/printing outside that range, since that's not the intended use of the variable).

Temporarily colour Linux Terminal foreground and background text

How can I temporarily set the colors of my Linux Terminal? I wish to add to a script, a color setting so that I remember to run the partner script a few minutes later. The color change would be set on in one script and removed in the other and would act as a visible reminder to me.
So the color change needs to be applied after the terminal is started up and needs to stay for all subsequent typing until it is removed by another equivalent command.
My terminal is GNOME Terminal 2.31.3
There's more than one way to change colors. VTE (the actual terminal within GNOME Terminal) implements these features (generally from xterm):
"ANSI color" escapes (which would be useless to you, since many programs reset those)
changing the text foreground and background using non-ANSI dynamic colors (resetters are rare)
changing the color palette (again, resetters are rare)
The latter two are documented in XTerm Control Sequences, in the section Operating System Commands:
OSC Ps ; Pt BEL
OSC Ps ; Pt ST
gives the form of the control sequence, e.g., escape]Ps;PtBEL
The dynamic colors are described here:
The 10 colors (below) which may be set or queried using 1 0
through 1 9 are denoted dynamic colors, since the correspond-
ing control sequences were the first means for setting xterm's
colors dynamically, i.e., after it was started. They are not
the same as the ANSI colors. These controls may be disabled
using the allowColorOps resource. At least one parameter is
expected for Pt. Each successive parameter changes the next
color in the list. The value of Ps tells the starting point
in the list. The colors are specified by name or RGB specifi-
cation as per XParseColor.
and other colors here:
Ps = 4 ; c; spec -> Change Color Number c to the color spec-
ified by spec. This can be a name or RGB specification as per
XParseColor. Any number of c/spec pairs may be given. The
color numbers correspond to the ANSI colors 0-7, their bright
versions 8-15, and if supported, the remainder of the 88-color
or 256-color table.

Which ANSI code should I use to make text muted (dark gray)?

When I use code 1;30m it produces different results:
Xshell 5: gray and bold
PhpStorm terminal: only bold
Windows console: only gray
The goal is to make a part of text to be slightly muted, but if it possible, it should display similarly in most terminal clients.
Anyway I don't understand how "bold" flag can change the foreground color. What am I doing wrong?
ANSI didn't specify that. ANSI listed black, red, etc., and also mentions bold. How a particular terminal displays bold+black is implementation-defined (no standard applies).
"ANSI" refers to x3.64, withdrawn many years ago, replaced by ECMA-48 (aka ISO 6429).
For your amusement:
ECMA-48:
Control Functions for Coded Character Sets
Aren't bright colors the same as bold? (xterm FAQ)
How do I get color with VT100? (ncurses FAQ)
Confirmed, on xterm that displays a muted gray and on emacs it produces black.
You can try a 256-color code like ^[[38;2;85;85;85m (which may also give inconsistent results for the reasons mentioned in #ThomasDickey's linked articles).

Use arbitrary colors in Vim and terminator

I am working on terminal Vim colorscheme (for 256-color terminal) and I need a few dark colours that I could use as backgrounds. I'm not satisfied with ones available in standard palette - for example, color 22 (#005f00), the darkest shade of green, is still too bright.
I've read that terminal Vim does not allow specifying colors as RGB, so - to get arbitrary colors - I would have to tweak terminal emulator's color palette. Is there a way to tweak full 256-color palette in gnome-terminal / terminator? Preferences window only allows editing basic 16.
BTW, Chrome's hterm allows this via 'color-palette-overrides' preference (but has its own drawbacks).
Gnome-terminal doesn't offer a UI to alter the colors (apart from the first 16), but you can use escape sequences, e.g.:
echo -ne '\e]4;22;#004f00\a'
As you've mentioned, sometimes these colors get reset to their default values. This was a bug in the underlying VTE library, and got fixed in version 0.36.
As far as I know, you won't find a single terminal emulator that gives you that kind of control over the whole standardized xterm palette.
So, if you ever intend to share that colorscheme you are stuck with the default palette.
On the other hand, if that colorscheme is only meant for your usage or if you are OK with forcing a hard dependency on your users, you can use japh's colorcoke to generate an alternate palette more suited to your needs. See the repo's wiki for examples)

color issue with VIM and iTerm2

I have a color issue on iTerm 2 (both stable and beta release) using VIM (last version).
This is a screenshot on iTerm 2 using vim-css-color plugin :
And the same on the Terminal.app :
As you can see, iTerm renders quite strange colors (and not only with this plugin, this is just an example). I've been playing with the contrast slider in iTerm2 prefererences and every Vim parameter i found so far (x-term-color-256, etc etc).
This is my .vimrc file : https://github.com/nanark/.vim/blob/master/vimrc
Any idea ?
A terminal with 256 color support (like iTerm 2) is simply not capable of displaying the full range of colors.
The css plugin uses a conversion to approximate the hex color code in the terminal. This was designed to work with the default set of colors used by xterm based on the comments in the code.
If you want an accurate preview, you should use gvim or macvim.

Resources