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

cterm definitions for templates with dark and light backgrounds #54

Closed
habamax opened this issue Feb 9, 2022 · 5 comments · Fixed by #55
Closed

cterm definitions for templates with dark and light backgrounds #54

habamax opened this issue Feb 9, 2022 · 5 comments · Fixed by #55

Comments

@habamax
Copy link
Contributor

habamax commented Feb 9, 2022

If template has definitions for both dark and light, dark has only gui definitions:


hi clear
let g:colors_name = 'habamax'

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

hi! link ErrorMsg Error
hi! link FoldColumn LineNr
hi! link LineNrAbove LineNr

..........

if &background ==# 'dark'
  let g:terminal_ansi_colors = ['#262626', '#d75f5f', '#87af87', '#afaf87', '#5f87af', '#af87af', '#5f8787', '#949494', '#626262', '#d7875f', '#afd7af', '#d7d787', '#87afd7', '#d7afd7', '#87afaf', '#bcbcbc']
  hi Normal guifg=#bcbcbc guibg=#262626 gui=NONE cterm=NONE
  hi Statusline guifg=#262626 guibg=#949494 gui=NONE cterm=NONE

  .............

  unlet s:t_Co
  finish
endif
@habamax
Copy link
Contributor Author

habamax commented Feb 9, 2022

Basically if I set bg=light then everything seems to work (switching t_Co and termguicolors is properly handled). For the dark it uses default cterm definitions.

@habamax
Copy link
Contributor Author

habamax commented Feb 9, 2022

@romainl fyi

@habamax habamax changed the title Fix for the termguicolors cterm definitions for templates with dark and light backgrounds Feb 9, 2022
@habamax
Copy link
Contributor Author

habamax commented Feb 9, 2022

Also (minor) links are defined for each block:

  • uncoditionally
  • for 256
  • for 16
Background: any

; Links
ErrorMsg           -> Error
FoldColumn         -> LineNr
LineNrAbove        -> LineNr
LineNrBelow        -> LineNr
SpecialKey         -> NonText
EndOfBuffer        -> NonText
QuickFixLine       -> CursorLine
Terminal           -> Normal
StatuslineTerm     -> Statusline
StatuslineTermNC   -> StatuslineNC
TabLineFill        -> TabLine

Results in:

hi! link ErrorMsg Error
hi! link FoldColumn LineNr
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
hi! link SpecialKey NonText
hi! link EndOfBuffer NonText
hi! link QuickFixLine CursorLine
hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
hi! link TabLineFill TabLine

...

if s:t_Co >= 256
  hi! link ErrorMsg Error
  hi! link FoldColumn LineNr
  hi! link LineNrAbove LineNr
  hi! link LineNrBelow LineNr
  hi! link SpecialKey NonText
  hi! link EndOfBuffer NonText
  hi! link QuickFixLine CursorLine
  hi! link Terminal Normal
  hi! link StatuslineTerm Statusline
  hi! link StatuslineTermNC StatuslineNC
  hi! link TabLineFill TabLine

...

if s:t_Co >= 16
  hi! link ErrorMsg Error
  hi! link FoldColumn LineNr
  hi! link LineNrAbove LineNr
  hi! link LineNrBelow LineNr
  hi! link SpecialKey NonText
  hi! link EndOfBuffer NonText
  hi! link QuickFixLine CursorLine
  hi! link Terminal Normal
  hi! link StatuslineTerm Statusline
  hi! link StatuslineTermNC StatuslineNC
  hi! link TabLineFill TabLine

...

@habamax
Copy link
Contributor Author

habamax commented Feb 9, 2022

Ignore the links, I should put them before any background definition and it would define them once.

@lifepillar
Copy link
Owner

Thanks for reporting. I have reverted the last commit in master and created a dev branch to address vim/colorschemes#54.

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

Successfully merging a pull request may close this issue.

2 participants