edkolev / tmuxline.vim

Simple tmux statusline generator with support for powerline symbols and statusline / airline / lightline integration
MIT License
1.61k stars 90 forks source link

Is it possible to set the color using an ascii escape, rather than 8bit xterm code? #36

Open nfarrar opened 9 years ago

nfarrar commented 9 years ago

Some terminals (for examples iTerm2) support more than 8-bit colors ... and the color scheme I'm currently using in my terminal makes use of full RGB colors. Is there a way to set the colors using the ansi escapes rather than RGB values so that they'll be displayed using my terminal emulator's color theme?

edkolev commented 9 years ago

I don't think tmux understands true color (8bit) unless you patch it.

Anyway, you could do this: create a tmuxline.conf file with :TmuxlineSnapshot, then eidt tmuxline.conf (modify the colors as needed) and then source it with tmux source tmuxline.conf.

Please let me know if you manage to achieve this - I may add it to the core of the plugin (although first vim will have to be able to use true color without any patches)

nfarrar commented 9 years ago

Still playing around with this. Tmux correctly displays 24-bit rgb color (assuming your terminal emulator does), and I've got tmuxline configured to use my custom color mappings (0..15), still trying to figure out how to calculate and override the the xterm extended color palette with consistent truecolors calculated from the base.

AlessioRocco commented 8 years ago

Since https://github.com/tmux/tmux/commit/427b8204268af5548d09b830e101c59daa095df9 tmux has true color, any plan to support it?

rawaludin commented 7 years ago

Here's how solarized in vim-airline and tmuxline not match when I activate true color in tmux

screen shot 2017-02-06 at 1 59 06 pm
rawaludin commented 7 years ago

This discussion will help one to activate true color in tmux https://github.com/tmux/tmux/issues/34

I use this one https://github.com/tmux/tmux/issues/34#issuecomment-241527745

rawaludin commented 7 years ago

Here's how to check true color in terminal https://gist.github.com/XVilka/8346728

rawaludin commented 7 years ago

I use this solarized theme https://github.com/frankier/neovim-colors-solarized-truecolor-only

rawaludin commented 7 years ago

For example, I see generated tmux theme are using ctermfg from theme. If I use guifg value, I successfully get true color.

Here example for OceanicNext theme: https://github.com/mhartington/oceanic-next/blob/master/colors/OceanicNext.vim

Generated theme: https://gist.github.com/rawaludin/e2fd38c29ddc32507a76a7178be350c1

What it should be: https://gist.github.com/rawaludin/ab862046bdc6ac1bc5ed62d9ba13f54f

I use this setup:

let g:tmuxline_preset = {
      \'a'               : '#{?client_prefix,#[reverse][P]#[noreverse] ,}#{?window_zoomed_flag,#[reverse][F]#[noreverse] ,}#S',
      \'win'             : ['#I', '#W'],
      \'cwin'            : ['#I', '#W'],
      \'x'               : '#(focus)',
      \'y'               : ['%a, %b %d'],
      \'z'               : '%R #(bat)',
      \'options'         : {
        \'status-justify'  : 'left'}
      \}
" simple
let g:tmuxline_separators = {
    \ 'left' : '',
    \ 'left_alt': '|',
    \ 'right' : '',
    \ 'right_alt' : '|',
    \ 'space' : ' '}

Oh, and set -g status-utf8 "on" is deprecated.