alvarosevilla95 / luatab.nvim

Tabline lua plugin for neovim
MIT License
190 stars 19 forks source link

How to replicate the look of the example in the readme? #14

Open PowerUser64 opened 2 years ago

PowerUser64 commented 2 years ago

I really like the way you made the example in the readme look, but I can't seem to replicate it. I took a look at your colors.vim and plugins/config.lua files, but I couldn't get it to look quite right. What should I do to make my tabline look like the example in the readme? My color scheme is navarasu/onedark.nvim, if that makes a difference.

edit: Here is what I have right now: screenshot of tabline

alvarosevilla95 commented 2 years ago

Hey glad you like it!

The three hl groups you're concerned about are these (the use of exec is to inject env vars):

    exec('au ColorScheme gruvbox hi TabLine gui=none guibg=' . $color01 . ' guifg=' . $color03)
    exec('au ColorScheme gruvbox hi TabLineSel guibg=' . $color01 . ' guifg=' . $color06)
    exec('au ColorScheme gruvbox hi TabLineFill guibg=' . $color01)

In my case, I set the background of all 3 groups to be my actual bg color. Then for TabLine (non-selected tabs) I dim the fg color, while for TabLineSel I use my main fg color.

PowerUser64 commented 2 years ago

Oh, I just discovered what's not working. I was trying to use environment variables I don't have set.

Now I almost have it. The missing piece is how did you get your selected tab to be bold?

And one other thing: do you know if there is a way to read from the color values neovim currently has set? I have the color values from my theme entered into the fields, but if I were to change themes, the colors would be wrong.

au ColorScheme * hi TabLine gui=none guibg='#282C34' guifg='#5C6370'  " all tabs color
au ColorScheme * hi TabLineSel       guibg='#282C34' guifg='#B5BBC7'  " Highlighted tab color
au ColorScheme * hi TabLineFill      guibg='#282C34'                  " tabline portion without tabs (right-hand side)

Current state: screenshot of tabline

mattfritz commented 2 years ago

@PowerUser64 Thanks for posting this. I had the same desire and experimented with your post above. By inverting the values in guibg and guifg in the TabLineSel autocommand, I get something similar to your original screenshot at the beginning of the thread:

vim.cmd([[au ColorScheme * hi TabLine gui=none guibg='#282C34' guifg='#5C6370']])
vim.cmd([[au ColorScheme * hi TabLineSel guibg='#B5BBC7' guifg='#282C34']])
vim.cmd([[au ColorScheme * hi TabLineFill guibg='#282C34' ]])
image

In regards to returning colors that are currently set on highlight elements, I think you can do something like this to get individual attribute values to later set color variables through a script like $color1 etc.:

:echo synIDattr(synIDtrans(hlInD("TabLineSel")), "fg#")

Also, thank you @alvarosevilla95 for making a simple and composable plugin. Awesome work!

djensenius commented 2 years ago

I'm seeing the greenish(?) tab, and wanting to change it:

image

But I'm a bit confused as to where and when to set the colours.