question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matching color schemes

See original GitHub issue

Problems summary

I’d like some configuration option similar to fzf-vim for matching the fzf color scheme to vim’s current.


" Customize fzf colors to match your color scheme
" - fzf#wrap translates this to a set of `--color` options
let g:fzf_colors =
\ { 'fg':      ['fg', 'Normal'],
  \ 'bg':      ['bg', 'Normal'],
  \ 'hl':      ['fg', 'Comment'],
  \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  \ 'hl+':     ['fg', 'Statement'],
  \ 'info':    ['fg', 'PreProc'],
  \ 'border':  ['fg', 'Ignore'],
  \ 'prompt':  ['fg', 'Conditional'],
  \ 'pointer': ['fg', 'Exception'],
  \ 'marker':  ['fg', 'Keyword'],
  \ 'spinner': ['fg', 'Label'],
  \ 'header':  ['fg', 'Comment'] }

In this dictionary, fzf color scheme will always match vim’s. Is this possible?

Expected

A config option existed to keep fzf and vim color scheme in sync.

Environment Information

  • fzf-preview version (package.json): HEAD

  • OS: Fedora 32

  • Vim/Neovim version: Vim 8

Provide a minimal init.vim

" call plug#begin('~/.vim/plugged')
" Plug 'junegunn/fzf'
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Plug 'ryanoasis/vim-devicons'
" call plug#end()
" 
" let g:coc_global_extensions = ['coc-fzf-preview']

Screenshot

Dockerfile that reproduces the problem (if possible)

Refer to https://github.com/yuki-ycino/fzf-preview.vim/blob/master/.github/issue_example/Dockerfile

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yuki-yanocommented, Oct 24, 2020

If it is resolved, I will close it once. I’ll consider implementing it when the need arises.

1reaction
yuki-yanocommented, Oct 15, 2020

If you use reflection, I have confirmed that this code works, but you do so at your own risk. If the fzf code is changed, it will not work.

augroup fzf_preview
  autocmd!
  autocmd User fzf_preview#initialized call s:fzf_preview_settings()
augroup END

function! FzfColor()
  if !exists('g:fzf_colors')
    return ''
  endif

  let lines = filter(split(execute('script'), '\n'), { _, v -> v =~# 'junegunn/fzf/plugin/fzf.vim' })
  if len(lines) < 1
    return ''
  endif

  let file_nums = matchlist(lines[0], '^\s*\(\d\+\)')
  if len(file_nums) <= 1
    return ''
  endif

  let func_name = "\<SNR\>" . file_nums[1] . '_defaults()'
  if !exists('*' . func_name)
    return ''
  endif

  let option = matchlist(execute('echo ' . func_name), '''--color=\(.\+\)''')
  if len(option) <= 1
    return ''
  endif

  return option[1]
endfunction

let g:fzf_colors = {
\ 'fg':      ['fg', 'Normal'],
\ 'bg':      ['bg', 'Normal'],
\ 'hl':      ['fg', 'Comment'],
\ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+':     ['fg', 'Statement'],
\ 'info':    ['fg', 'PreProc'],
\ 'border':  ['fg', 'Ignore'],
\ 'prompt':  ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker':  ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header':  ['fg', 'Comment']
\ }

function! s:fzf_preview_settings() abort
  let g:fzf_preview_fzf_color_option = FzfColor()
endfunction
Read more comments on GitHub >

github_iconTop Results From Across the Web

Coolors - The super fast color palettes generator!
Create the perfect palette or get inspired by thousands of beautiful color schemes. Start the generator! Explore trending palettes. We are 3 million...
Read more >
100 color combination ideas and examples - Canva
Examples of 100 color combinations, how to apply them and a color wheel to show you what colors go well together.
Read more >
80 Eye-Catching Color Combinations For 2021 - Design Wizard
Over 80 stunning colour combinations for your designs, interiors or ... Color matching will essentially improve your design's visual appeal.
Read more >
10 Best Color matching chart ideas - Pinterest
Jan 15, 2020 - Explore Shahila Ahmad's board "Color matching chart" on Pinterest. See more ideas about color, color combos, color combinations.
Read more >
50 Color Combinations You Need to Use in 2022 - Looka
1. Pink and yellow. pink and yellow color combination. HEX Codes: #C7395F, #DED4E8, #E8BA40. This sweet spring color palette ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found