The new face has no attributes or underline colour set, therefore it should not change the appearance of any opaque colour applied on top of it. For transparent colours, it should harmonise the colours of the separators with the colours of the rest of the segments.
Description
Define a new powerline_base face with the default background colour as both background and foreground, and use it as a base when passing the faces for the separators between the different segments of the Powerline.
Kakoune supports transparent colours in faces. If:
1) the background colour used for this base (through %opt{powerline_base_bg}, usually alined on %opt{powerline_color08}) is an RGB colour defined as rgb:RRGGBB or rgba::RRGGBBAA
2) colours applied on top of it, for example powerline_color03 for the bufname background, have an alpha value set
... Then transparency can be applied even to the background colour for the segment, resulting in the blending of powerline_color03 with the buffer background colour.
One use case, for example, is to build a colour theme for the modeline with different shades from a single colour, playing on the values of the alpha channel. Such a scheme presents two advantages: first, we do not have to pick individual colours for each segment background. Finding a single hexadecimal code is enough (and we can even reuse some colours from Kakoune's current colour scheme). Secondly, this theme is trivial to adapt when we switch to a different Kakoune colour scheme.
Let's consider the following example, relying on a colour scheme for Kakoune that defines a colour named black and uses it as a background colour for the buffer, and a white colour for its foreground. This is the case, for example, of several themes available here (although black is commented by default so that users can keep their terminal's background colour). We can define the following Powerline theme:
This way, we create a Powerline theme that is automatically adjusted to the colour scheme that Kakoune uses on startup. We can replace the call to "powerline-theme-recolor" with the following:
hook global BufSetOption ^black=.* %{
powerline-theme-recolor
powerline-rebuild-buffer
}
This time, we even recompute the colours when the main colour scheme changes (in practice, when the black option changes): switching from ayu-dark to pastel and then to monokai makes the Powerline theme adjust automatically!
Most of this is already possible with the existing code, provided the colour theme for Kakoune uses RGB colours for foreground and background. However, the base for the separators needs to be adjusted, because their foreground is in fact a background value (the one of the coming segment), thus necessiting base with the buffer background colour as foreground instead of Default.
Screenshots
Ayu-dark with black colour uncommented, before the patch. Note the inconsistent appearance of the separators (no foreground transparency, or rather, blending in of white with white, resulting in an opaque colour):
Ayu-dark (same), with the Powerline patch applied:
After typing :colorscheme monokai (also edited to set the black colour):
Breaking change
no
The new face has no attributes or underline colour set, therefore it should not change the appearance of any opaque colour applied on top of it. For transparent colours, it should harmonise the colours of the separators with the colours of the rest of the segments.
Description
Define a new
powerline_base
face with the default background colour as both background and foreground, and use it as a base when passing the faces for the separators between the different segments of the Powerline.Kakoune supports transparent colours in faces. If:
1) the background colour used for this base (through
%opt{powerline_base_bg}
, usually alined on%opt{powerline_color08}
) is an RGB colour defined asrgb:RRGGBB
orrgba::RRGGBBAA
2) colours applied on top of it, for examplepowerline_color03
for the bufname background, have an alpha value set... Then transparency can be applied even to the background colour for the segment, resulting in the blending of
powerline_color03
with the buffer background colour.One use case, for example, is to build a colour theme for the modeline with different shades from a single colour, playing on the values of the alpha channel. Such a scheme presents two advantages: first, we do not have to pick individual colours for each segment background. Finding a single hexadecimal code is enough (and we can even reuse some colours from Kakoune's current colour scheme). Secondly, this theme is trivial to adapt when we switch to a different Kakoune colour scheme.
Let's consider the following example, relying on a colour scheme for Kakoune that defines a colour named
black
and uses it as a background colour for the buffer, and awhite
colour for its foreground. This is the case, for example, of several themes available here (althoughblack
is commented by default so that users can keep their terminal's background colour). We can define the following Powerline theme:This way, we create a Powerline theme that is automatically adjusted to the colour scheme that Kakoune uses on startup. We can replace the call to "powerline-theme-recolor" with the following:
This time, we even recompute the colours when the main colour scheme changes (in practice, when the
black
option changes): switching from ayu-dark to pastel and then to monokai makes the Powerline theme adjust automatically!Most of this is already possible with the existing code, provided the colour theme for Kakoune uses RGB colours for foreground and background. However, the base for the separators needs to be adjusted, because their foreground is in fact a background value (the one of the coming segment), thus necessiting base with the buffer background colour as foreground instead of
Default
.Screenshots
Ayu-dark with
black
colour uncommented, before the patch. Note the inconsistent appearance of the separators (no foreground transparency, or rather, blending in ofwhite
withwhite
, resulting in an opaque colour):Ayu-dark (same), with the Powerline patch applied:
After typing
:colorscheme monokai
(also edited to set theblack
colour):After typing
:colorscheme mygruvbox
(idem):After typing
:colorscheme pastel
(idem):