Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using terminal's default fg and bg in 16/8-color variant #24

Closed
jan-warchol opened this issue Mar 2, 2020 · 2 comments
Closed

Using terminal's default fg and bg in 16/8-color variant #24

jan-warchol opened this issue Mar 2, 2020 · 2 comments

Comments

@jan-warchol
Copy link

jan-warchol commented Mar 2, 2020

First, thanks for making this great toolkit! Very nice :-)

I'm working on colortemplate for selenized and there's one thing I'm missing: being able to define a Color that will use terminal's default background (or foreground) when used in 16/8-color mode. Currently color definitions can specify only one of 16 ANSI colors, but actually all terminals have a separate setting for foreground and background color. (I.e. default background doesn't have to be the same as ANSI black).

Here's a minimal example:

# vim: ft=colortemplate
Full name:  background and foreground test
Short name: bg_fg_test
Author:     JW <[email protected]>

Background: dark

# Color palette
Color:      bg_grey #181818 ~ Black  # I'd like to say "bg" or "none" here,
Color:      fg_grey #b9b9b9 ~ White  # but it throws an error

# Highlight group definitions
Variant:    gui 256 8
Normal fg_grey bg_grey

Combined with terminal palette defined like this:

bg: #181818
black: #3b3b3b
br_black: #626262
white: #8c8c8c
fg: #b9b9b9
br_white: #e7e7e7
...

Which means that it looks as follows:

image

The result in terminal Vim is different than in GUI Vim:

image

(background in terminal vim is 3b3b3b while it should be 181818, foreground is e7e7e7 while it should be b9b9b9).

I've been able to work around this with something like this, but it's a bit lame...

# vim: ft=colortemplate
Full name:  background and foreground test
Short name: bg_fg_test
Author:     JW <[email protected]>

Background: dark

# Color palette
Color:      bg_grey #181818 ~ Black
Color:      fg_grey #b9b9b9 ~ White

# Highlight group definitions
Variant:    gui 256
Normal fg_grey bg_grey

Variant:    8
Normal none none
@lifepillar
Copy link
Owner

The current master should address this. You may now write:

Color:      bg_grey #181818 ~ none
Color:      fg_grey #b9b9b9 ~ none

to have ctermfg and/or ctermbg items set to NONE in variants with 16 colors or less. The none keyword is not highlighted, but I'll fix that, too.

@jan-warchol
Copy link
Author

It works! You're amazing, thanks :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants