manateelazycat / awesome-tab

Emacs package to provide out-of-the-box configuration to use tabs.
383 stars 38 forks source link

Set faces based on the environment color. #38

Closed AmaiKinono closed 5 years ago

AmaiKinono commented 5 years ago

Colors of the faces are set based on the current background/foreground color, thus making it looks beautiful on both light/dark themes. Below are some examples:

doom-peacock theme: doom-peacock

doom-nord theme: doom-nord

doom-one-light theme: doom-one-light

The color blend function comes from this blog post. The settings has been tested with various themes and they all looks really well.

Here's one thing I still want to fix: after changing the theme, the faces does not change. I tried to run a hook to set all the faces again and restart awesome-tab-mode after changing theme, but it turns out to be like this:

2019-06-30-223618_548x76_scrot :cry:

The faces are refreshed, but the space between tabs is not. I need your help to inspect the reason and fix this.

manateelazycat commented 5 years ago

First thank you so much for this awesome patch!

The reason of tab's background is not change with theme switch is: All awesome-tab-separtor-* variables is created by function awesome-tab-separator-memoize that mean those awesome-tab-separtor-* background is same as default face when awesome-tab plugin first load.

I have commit https://github.com/manateelazycat/awesome-tab/commit/c5fd9476fb492383c194d8805c8ce1515646abc0 Use awesome-tab-separator-memoize re-created awesome-tab-separtor-* variables every time we call awesome-tab-line-format Then awesome-tab separtor's background can change with theme switch.

And i need call awesome-tab-color-blend in awesome-tab-line-format. In order to save communication time, I created a new patch

I have add your name in acknowledgements list.

Thanks for great work, it's awesome!!!

AmaiKinono commented 5 years ago

Thanks for the answer. There's still a problem: I have to run a hook to turn off and on awesome-tab after changing theme, or it will look like this:

2019-07-01-151946_826x364_scrot Changing from dark theme to light theme

Then if I switch the tag, it shows correctly. My thought is we have to redisplay the tabs after changing the theme, but the only way I can think of is to advise the load-theme function, which shouldn't be a good idea. Or we can advise the user to add a redisplay function to his/her changing-theme-hook. Emacs doesn't come with a hook like that, but as far as I am concerned, many users define this hook on their own.

AmaiKinono commented 5 years ago

Here's another issue: tags won't display in terminal, it shows a band there.

2019-07-01-154540_804x472_scrot

I remember awesome-tab works in the terminal before, so I did this:

(fset #'awesome-tab-adjust-color-with-theme 'ignore)

now it looks like this, the selected tab is not highlighted:

2019-07-01-154558_804x446_scrot

manateelazycat commented 5 years ago

Here's another issue: tags won't display in terminal, it shows a band there.

2019-07-01-154540_804x472_scrot

I remember awesome-tab works in the terminal before, so I did this:

(fset #'awesome-tab-adjust-color-with-theme 'ignore)

now it looks like this, the selected tab is not highlighted:

2019-07-01-154558_804x446_scrot

建议你做一个Patch,判断不同环境的时候加载不同的代码

manateelazycat commented 5 years ago

Thanks for the answer. There's still a problem: I have to run a hook to turn off and on awesome-tab after changing theme, or it will look like this:

2019-07-01-151946_826x364_scrot Changing from dark theme to light theme

Then if I switch the tag, it shows correctly. My thought is we have to redisplay the tabs after changing the theme, but the only way I can think of is to advise the load-theme function, which shouldn't be a good idea. Or we can advise the user to add a redisplay function to his/her changing-theme-hook. Emacs doesn't come with a hook like that, but as far as I am concerned, many users define this hook on their own.

这个还好,用户不是经常换主题,即使换了主题,标签一切换就好了,我觉得暂时不用管它。 因为Emacs没有标准的切换主题的hook

AmaiKinono commented 5 years ago

我想在自己配置中实现切换主题时重新显示 tab,但重启 awesome-tab-mode 后之前重排过的顺序会复原。现在我能想到的是走一遍 buffer 然后把 awesome-tab-local-mode 开关一遍,不知您是否有更好的建议?