rakr / vim-one

Adaptation of one-light and one-dark colorschemes for Vim
MIT License
2k stars 197 forks source link

No transparent background #101

Open con-f-use opened 4 years ago

con-f-use commented 4 years ago

I'm using transparency with my terminal emulator. Using one sets a solid, opaque background. How do I change that?

tommady commented 4 years ago

same here 👋

con-f-use commented 4 years ago

Hey @tommady, I put this in my rc file. It doesn't work 100% perfectly but good enough:

if (has("autocmd") && !has("gui_running"))
  augroup colorset
    autocmd!
    let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" }
    autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting
  augroup END
endif
colorscheme onedark
let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" }
call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting

It's somewhere burred deep in the customization documentation. I consider it rather hacky, especially seeing that I neded it as both autocmd and then invocation right after setting the color scheme.

baco commented 3 years ago

That configuration is for other colorscheme, onedark.vim by joshdick, not vim-one. You are loading it when you call colorscheme onedark and the function call onedark#set_highlight("Normal", { "fg": s:white }) is available in that other colorscheme

baco commented 3 years ago

A more accurate hack, using vim-one functions, would be to add in your init.vim/vimrc:

if has('autocmd') && !has('gui_running')
    augroup colorset
        autocmd!
        autocmd ColorScheme one silent!
            \ call one#highlight('Normal', '', 'none', '')
    augroup END
endif