vim / colorschemes

colorschemes for Vim
289 stars 23 forks source link

Add include template for t_Co=0 #73

Closed neutaaaaan closed 3 years ago

neutaaaaan commented 3 years ago

As requested in irc, the include template for clutter-free t_Co=0 fallback, as used in monochrome.

Not much more to say about it.

habamax commented 3 years ago

Should we mark includes with some prefix? Like _tcozero?

Also what would happen if you press BuildAll! button? Would colortemplate try to also build a tcozero colorscheme?

neutaaaaan commented 3 years ago

I have no idea, I don't use the colortemplate ui and I never tried building that file by itself. The prefix sounds like a good idea, that's already how Lifepillar handled includes.

habamax commented 3 years ago

There is a way to build all colortemplates with a command, and I believe it will try to also build that include. AFAIR, @lifepillar doesn't use .colortemplate for includes.

habamax commented 3 years ago

yes, indeed: ColortemplateAll!:

image

habamax commented 3 years ago

Include: _tcozero works actually for t_Co=0. Not sure why though.

image

habamax commented 3 years ago

vim-tcozero

habamax commented 3 years ago

@neutaaaaan could you rename it to _tcozero (without .colortemplate extension)?

habamax commented 3 years ago

@lifepillar, could you explain how colortemplate handles t_Co=0?

romainl commented 3 years ago

@habamax https://github.com/lifepillar/vim-colortemplate/blob/master/doc/colortemplate.txt#L300 so it doesn't appear to be handled to me.

lifepillar commented 3 years ago

@lifepillar, could you explain how colortemplate handles t_Co=0?

At the beginning of each color scheme, you may find this line:

let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 2

So, whenever t_Co is non-existing, undefined, or its value is less than 2, what is defined as Variant: 2 in the template will be used.

Also what would happen if you press BuildAll! button? Would colortemplate try to also build a tcozero colorscheme?

By convention, names starting with an underscore are considered included templates, and are not built directly by Colortemplate[All]. The .colortemplate suffix is optional.

habamax commented 3 years ago

So, whenever t_Co is non-existing, undefined, or its value is less than 2, what is defined as Variant: 2 in the template will be used.

Aha, that was my observation too for Variant: 2, thx for confirming it!

lifepillar commented 3 years ago

Please note that the current Colortemplate's master now generates code using cterm attributes for Variant: 2. You should now use Variant: 0 (preferred) or Variant: 1 for b/w color schemes such as this.

habamax commented 3 years ago

Thank you!

I have only added it to desert, will change it tomorrow.

lifepillar commented 3 years ago

You should rebuild all color schemes, because this line:

let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 2

is now replaced by

let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 1

Note the last 1 instead of 2.

habamax commented 3 years ago

You should rebuild all color schemes, because this line:

We will rebuild them gradually anyway when _tcozero include would be added. For now I have added it only to desert.