Tmux transparent status bar - tmux

I'm not sure it this is possible but I use a graphical terminal emulator that has a translucent background so I can see the GUI windows behind it (in this case tinted a shade of blue). I want my status Line to have this as its background color.

I was able to find this useful example: http://jasonwryan.com/blog/2010/01/07/tmux-terminal-multiplexer/
And it used the color default.
so what I wanted was:
set status-bg default
EDIT: this might not work in newer versions of tmux, see other answers below

The accepted answer from olleicua (to be more specific, the comment from sammy) stopped working for me as of tmux 3.2.
I changed the line to the following and now it's working again:
set-option -g status-style bg=default
The "3.2 questions and comments" thread on the official github page explains why this is the case:
status-fg and status-bg are now applied before status-style rather than instead of; this means that if either is set to default the status-style colour will be used. To fix, replace status-bg default with status-style bg=default.

Related

Is it possible to change the background color of a Spyder Python console?

I'm wondering if it's possible to change the background color of a Python regular console in Spyder. I know Spyder already allows to change between two colors: Black or white. But is there any way to get a different color besides those?
(Spyder maintainer here) For Spyder versions lesser than 3.2.0, there is no way to change the background to a different color, sorry.
For versions greater or equal to 3.2.0, the Python console is completely removed, so this no longer applies.
Finally, since 3.2.0 our IPython consoles follow the same color scheme of the Editor without any additional configuration.
Yes! Go to "Tools" and "Preferences" and then "Syntax coloring". There are a handful of preset themes. There is also an option to create a custom theme if you don't find any of the defaults aesthetically pleasing (I know I didn't).

Change background color of active or inactive pane in Tmux

Are there any options to control the background color of the active or inactive panes in Tmux?
It seems that tmux-2.1 (released 18 October 2015) now allows the colours of individual panes to be specified. From the changelog:
* 'select-pane' now understands '-P' to set window/pane background colours.
e.g. [from the manual] to change pane 1's foreground (text) to blue and background to red use:
select-pane -t:.1 -P 'fg=blue,bg=red'
To mimic iTerm colour scheme:
To answer the original question, I use the following lines in my ~/.tmux.conf for setting the background/foreground colours to mimic the behaviour in iTerm:
#set inactive/active window styles
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
# set the pane border colors
set -g pane-border-style 'fg=colour235,bg=colour238'
set -g pane-active-border-style 'fg=colour51,bg=colour236'
I hadn't seen the window-style and window-active-style commands before, but maybe they were available in previous tmux versions.
Also, these two lines are pretty useful for splitting panes easily:
bind | split-window -h
bind - split-window -v
EDIT: as Jamie Schembri mentions in the comments, tmux version 2.1 (at least) will now be installed with:
brew install tmux
EDIT (Oct 2017): brew now installs tmux 2.6, and the above still works.
EDIT Vim panes: If you find that the "inactive colouring" does not work with a Vim pane, it might be due to the colourscheme you are using. Try with the pablo scheme; i.e. in the Vim pane:
:colo pablo
To make it work with your own custom Vim colourscheme, make sure that the setting for Normal highlighting does not have ctermbg or guibg specified. As an example, the "inactive colouring" does not work with the murphy colourscheme, because in murphy.vim there is the line:
hi Normal ctermbg=Black ctermfg=lightgreen guibg=Black guifg=lightgreen
that sets ctermbg or guibg to Black. However, changing this line to:
hi Normal ctermfg=lightgreen guifg=lightgreen
will make the "inactive colouring" work.
EDIT July 2019 Augusto provided a good suggestion for also changing the background colour for the line numbers. What I use in my vim colourscheme is the following (you need to find and edit the colourscheme file):
hi Normal guifg=#e6e1de ctermfg=none gui=none
hi LineNr guifg=#e6e1de ctermfg=none gui=none
There is no option to change the background color of a pane, but there is option to set the pane-border color (style)
pane-active-border-style style
Set the pane border style for the currently active
pane. For how to specify style, see the message-command-style option.
Attributes are ignored.
pane-border-style style
Set the pane border style for paneas aside from the
active pane. For how to specify style, see the message-command-style option.
Attributes are
ignored.
I like this variation of https://stackoverflow.com/a/33553372:
# Make sure your 16-color terminal theme uses slightly
# different colors for `background` vs `black` (AKA `color0`).
# "Nord" or "Tango dark" themes do this out of the box.
# Use `white` instead of `black` for light themes.
set -g window-active-style 'fg=terminal,bg=terminal'
set -g window-style 'fg=terminal,bg=black'
set focus-events on
set-hook -g client-focus-in "set window-active-style 'fg=terminal,bg=terminal'"
set-hook -g client-focus-out "set window-active-style 'fg=terminal,bg=black'"
The last three lines may require a recent version of tmux (I use tmux 3.3),
and mark all panes inactive when the terminal window is not focused. I am not sure if set focus-events on is necessary. The lack of -g inside the hook is important (the subtle bug that prevents is left as an exercise to a reader interested in tmux arcana).
You can, of course, use a different window-style (e.g. brightblack, or fg=white,bg=black).
Older answer (a different approach)
Since tmux 3.3 (released Jun 1, 2022, so it may not have propagated to all distributions yet), there are new options to help disambiguate which pane is active (though these don't change the background color specifically):
# I find this together with default coloring of the active pane border sufficient
set -g pane-border-lines heavy
# More explicit options that I find a bit excessive
set -g pane-border-lines number
set -g pane-border-indicators both # Displays arrows pointing to the current pane.
On version 3.1, you can set hooks on pane focus in or out. You must set focus-events to 'on' first.
In a combination of dean.'s answer and user21952-is-a-great-name's answer, the pane-focus-out hook fires on the pane that you are moving out of, and you set the background and foreground appropriately - I used a slightly dimmer color scheme. The pane-focus-in hook then fires on the pane that is getting focus, and I set the colors both to default.
I didn't bother setting a target on select-pane as it seems to work without it, but there is an option for {last} (or {!}) according to the wiki.
set -g focus-events on
set-hook -g pane-focus-out 'select-pane -P bg=colour0,fg=colour10'
set-hook -g pane-focus-in 'select-pane -P bg=default,fg=default'
This appears to work in my terminal but does not affect colors of an open Vim session. It also fires when I scroll up, it seems the copy mode also unsets focus.
# highlight focused pane (tmux >= 2.1), possible values are:
# - true
# - false (default)
tmux_conf_theme_highlight_focused_pane=true
# focused pane colours:
#tmux_conf_theme_focused_pane_fg='default'
tmux_conf_theme_focused_pane_bg='#191919'

Tmux monitor activity change highlight color

I'm setting up my tmux.conf and I want to have the activity monitor with different colors. I would like to change the color of the highlight of the alerted window in the status bar.
The problem come when I try to change the color of the background. I'm using this options shown on the tmux manual page.
# activity window
setw -g monitor-activity on
setw -g window-status-activity-bg red
setw -g window-status-activity-fg yellow
When I reload the configuration I can see that the color of the letters in the alerted window change to red but I can't find the way to change the highlight of the alerted window.
What I'm missing?
EDIT: I'm using tmux 1.6 maybe updating to 1.9 solve the problem.
Thank you.

set tmux/R window background color when using Vim-R

I'm using MacVim and Vim-R to interactively edit and run R code. Everything seems to be working fine, but I can't seem to figure out how to set the background color in the tmux window that R runs in.
To be precise: I open up a .r file with MacVim. Then I type _rf, which causes XQuartz to start up, and a window with the title 'tmux' to open up with R running inside of it. When I highlight lines of code and send them to R from MacVim, everything seems to work fine. But the default background color of the tmux window is white, which makes the nicely colored output text hard to read.
How can I change the background color of the tmux window to something darker?
See this part of the doc to force your plugin to use the right terminal emulator.
If you don't want to do that (I think that you should), you can configure the appearance of xterm in the ~/.Xresources file. This guide gives you useful examples.

Oh My ZSH theme not matching colors

I'm trying to make this zsh theme work: https://gist.github.com/3712874
I've made some small changes to it but there is still one problem. It seems that the right triangle glyph doesn't get the same color as the text background. See this image:
Any ideas why this might happen, and how to fix it?
I made it look pretty good. I had to go change the opacity of my colors. Instead of 100% I had to fiddle a bit and set them around 76-81% depending on what color it was.
I believe I switched to iTerm2 to fix this issue in the end.
Solution
On Linux using Terminal I had to change the Profile Preferences->Colors. For example, I wanted to use the theme dpoggi. I downloaded the theme image, then used the dropper tool to match the "red" "green", "cyan", and "magenta" that are used in the dpoggi source code.
dpoggi theme
Terminal Profile Preferences->Colors
I found that playing with the "Cursor guide" transparency in Preferences > Profiles worked for me. It can also be disabled.

Resources