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.
Related
I am customizing my own color scheme for Vim but I don't know when should I configure ctermfg/ctermbg variable and guifg/guibg variable because I didn't see any differences between them at all. Is there any difference between them?
Can any one give me an illustrative example of how to use them ?
Thanks
I didn't see any differences between them at all
ctermxx is used by console version of Vim (when set notermguicolors). guixx is used in GVim, or in console if set termguicolors, and the console is capable of TrueColor, obviously. Hence you must test it in different programs to see the difference.
Also, some colors could be the same or very close to each other, e.g. "blue" is "blue" both in GUI and console.
Can any one give me an illustrative example of how to use them?
hi Normal guifg=#1034a6 guibg=#f5f5dc ctermfg=19 ctermbg=230
Should look very similar but still a little different in GUI and console
For symbolic colors names see :h cterm-colors and $VIMRUNTIME/rgb.txt. The cheat sheet of 256 color indexes for console is available here.
The separate pairs allow you to specify different colors for a terminal (which may limit you to a fixed-sized palette of colors, usually 16 or 256) and a GUI (which typically provides a much larger palette or even direct access to any color your display can handle).
For example, if you start a session in your terminal using vi some_file.txt, then ctermfg and ctermbg would be used. If you start an instance of gvim (which opens its own window independent of your terminal emulator), then guifg and guibg are used instead.
I know that you can use escape sequence %{\033[0m%} (code zero) to change the color of the prompt back to "default" color (usually, after the prompt).
But what is the "default" that is used for this?
Default color of the terminal program itself?
Default color set via tput setaf $COLOR, assuming you use it to set font color different from terminal's default color?
Else?
It's terminal-dependent, but with regard to existing practice, it would have to be the former:
the default color of the terminal (program).
The other suggested choice would not be correct, since tput setaf does not set a "default color", but rather a "current color". Whether any choice of tput setaf corresponds to the terminal's default color is (at best) terminal-specific, since there is no relevant standard one way or the other.
ECMA 48 gives terse (one line) descriptions of SGR 0 (which is what's mentioned in the question), and SGR 30-37, 40-47 (the setaf/setab choices commonly used for terminal descriptions that tput would use).
There's another possible choice, i.e., tput op (selecting the original color pair), which is used in several terminal descriptions to send SGR 39 and 49. Again, this is terminal-specific and its relationship to SGR 0 is not covered by any standard. Those happen to use the same "default color" for xterm and Linux console, but (read ECMA-48) the standard does not give that level of detail regarding "default color" and the absence of "video attributes".
Further reading:
ECMA-48: Control Functions for Coded Character Sets
Who did it? (a brief history of the Linux console color model)
I want the color scheme to span completely across the terminal boundaries. I am using Color Scheme Scroller Plugin to switch between different theme. I have uploaded a .gif file so that you can clearly see what I want to get fixed. Vim colorschemes doesn't completely change the color of editor. There are some terminal color's borders left around the vim's overridden color scheme. How would I fix it.
Please check the image on this link. Stackoverflow doesn't allow uploading an image > 2Mb
You can't do that from Vim itself.
Terminal emulators use that padding to preserve readability when characters are displayed next to the borders of the window. The programs you run in your terminal have no knowledge of that padding and thus no ability to change it.
But you can read the documentation of your terminal emulator or take a look at its source code to find a way to enable/adjust/disable that padding.
FWIW, there's no way to change that in Terminal but it can be done for iTerm.
Alternatively, you could simply set the background color of your terminal to the one used in your vim colorscheme.
The image appears to depict behavior outside vim's control:
it is using a terminal emulator (could be xterm, could be some other).
the terminal emulator draws character cells on a window
those cells form a grid; the window may extend beyond the grid
the window can have a background color
the grid can have a background color
within the grid, most terminals provide some capability of drawing text with specific foreground and background colors
the grid can have a default background color which is not any of the specified colors
outside the grid, the window can also have a default background color
normally, the grid- and window-default backgrounds are the same
the window can be resized to (more or less) arbitrary sizes
the grid is constrained to exact character sizes
because of this difference, the window can have areas outside the grid which use its default color, and not match the grid's background color.
escape sequences which could affect the grid- and window-background colors are doing erases (see for example the ncurses FAQ My terminal shows some uncolored spaces).
though it is conceivable that erasures within the grid could affect those outside areas, doing that generally leads to odd visual effects.
I have my xterm inherit RGB values for its "color table" from an X resource file. As far as I understand, xterm does not just support 256 colors - it supports 256 color references pointing each to a 24-bit RGB space color, correct?
I would like to be able to reset the colors themselves, for example change the color with index 10 to an RGB value #ff8000 or something.
I don't even know if I have got my concepts right here. If I have, is it possible to change entries in this "color table" at runtime - for the current terminal window? Or one can only do so with xrdb for next opened terminal instance?
I'm not sure if this actually works (my xterm here isn't compiled with 256 color support!) but the xterm control sequence reference:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Look under "Operating System Controls"
P s = 4 ; c ; spec → Change Color Number c to the color specified by spec. This can be a name or RGB specification as per XParseColor. Any number of c name 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.
OSC is \033], so try this out:
echo -n -e '\033]4;7;red\007'
should change color #7 to red if it works.
I cannot find any references to command line arguments for pyqt, such as:
-style windows
-background "yellow"
I've only found a couple by accident.
Hasn't helped to Google it or use Qt Assistant. (Unless it's well hidden)
Thanks,
Paul
From the PyQt4 manual entry for QApplication:
(http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qapplication.html)
All Qt programs automatically support
the following command line options:
-style= style, sets the application GUI style. Possible values are motif,
windows, and platinum. If you compiled
Qt with additional styles or have
additional styles as plugins these
will be available to the -style
command line option.
-style style, is the same as listed above.
-stylesheet= stylesheet, sets the application styleSheet. The value must
be a path to a file that contains the
Style Sheet. Note: Relative URLs in
the Style Sheet file are relative to
the Style Sheet file's path.
-stylesheet stylesheet, is the same as listed above.
-session= session, restores the application from an earlier session.
-session session, is the same as listed above.
-widgetcount, prints debug message at the end about number of widgets left
undestroyed and maximum number of
widgets existed at the same time
-reverse, sets the application's layout direction to Qt.RightToLeft
-graphicssystem, sets the backend to be used for on-screen widgets and
QPixmaps. Available options are raster
and opengl.
-qmljsdebugger=, activates the QML/JS debugger with a specified port. The
value must be of format
port:1234[,block], where block is
optional and will make the application
wait until a debugger connects to it.
The X11 version of Qt supports some
traditional X11 command line options:
-display display, sets the X display (default is $DISPLAY).
-geometry geometry, sets the client geometry of the first window that is
shown.
-fn or -font font, defines the application font. The font should be
specified using an X logical font
description. Note that this option is
ignored when Qt is built with
fontconfig support enabled.
-bg or -background color, sets the default background color and an
application palette (light and dark
shades are calculated).
-fg or -foreground color, sets the default foreground color.
-btn or -button color, sets the default button color.
-name name, sets the application name.
-title title, sets the application title.
-visual TrueColor, forces the application to use a TrueColor visual
on an 8-bit display.
-ncols count, limits the number of colors allocated in the color cube on
an 8-bit display, if the application
is using the QApplication.ManyColor
color specification. If count is 216
then a 6x6x6 color cube is used (i.e.
6 levels of red, 6 of green, and 6 of
blue); for other values, a cube
approximately proportional to a 2x3x1
cube is used.
-cmap, causes the application to install a private color map on an
8-bit display.
-im, sets the input method server (equivalent to setting the XMODIFIERS
environment variable)
-inputstyle, defines how the input is inserted into the given widget, e.g.,
onTheSpot makes the input appear
directly in the widget, while
overTheSpot makes the input appear in
a box floating over the widget and is
not inserted until the editing is
done.