vim-one icon indicating copy to clipboard operation
vim-one copied to clipboard

Styling Request: More Atom-like Diff Styles

Open adamalbrecht opened this issue 7 years ago • 3 comments

This is more of a personal preference thing, but I'd love to see Diff styling that looks more like the original Atom versions of the theme, with red/green backgrounds rather than foregrounds. The Github Colorscheme for Vim does something similar to this. Thanks!

Atom One:

atom_one_light_diff

atom_one_dark_diff

Vim One

vim_one_light_diff

vim_one_dark_diff

Vim Github Colorscheme

vim_github_diff

adamalbrecht avatar Jun 13 '17 13:06 adamalbrecht

@rakr any updates on this ?

Diff colours are really not nice (with vim-fugitive Gdiff)

picaoao avatar Apr 09 '19 12:04 picaoao

I got Atom editor installed and found out I have only the green, red diff background color. The text color was not changed as illustrated in your images. Did you use the One Light/Dark theme? Or had some plugin installed?

laggardkernel avatar Apr 21 '21 15:04 laggardkernel

Update 1: remove some colorization in for patch file (defined by diff syntax), only makes the changed content stand out, not the title, index line, etc.

Have it implemented at the feature/diff branch in my fork. You can try it using following autocmd without switching to the fork.

There's two parts changed

  1. color for vimdiff, or nvim -d file1 file2
  2. color for patch file (defined by diff syntax)

They're rendered differently. I didn't keep background color in the 2nd type cause the bg is not rendered in full width of your screen in this situation, unlike what's done in vimdiff views.

Try it yourself. You can get a patch file like this, https://github.com/rakr/vim-one/pull/93.patch

function! OneDiffColor()
  " Response to https://github.com/rakr/vim-one/issues/53
  "
  " Vimdiff color source, from
  " - red, green from Atom One
  " - purple from Kaledoscope
  if g:colors_name ==# 'one'
    " clear to avoid disruption on changed line
    hi clear DiffChange
    hi clear DiffText
    if &background == 'light'
      call one#highlight('DiffAdd',    '#022B00', '#D9FBE3', '')
      call one#highlight('DiffDelete', '#FBE1E4', '#FBE1E4', 'none')
      call one#highlight('DiffChange', '#494b53', '#F6F1FF', '') " s:mono_1[0]
      call one#highlight('DiffText',   '#1E162F', '#D4BDFF', 'none')
    elseif &background == 'dark'
      call one#highlight('DiffAdd',    '#D9FBE3', '#264B3A', '')
      call one#highlight('DiffDelete', '#48313B', '#48313B', 'none')
      call one#highlight('DiffChange', '#abb2bf', '#3B2C5C', '') " s:mono_1[0]
      call one#highlight('DiffText',   '#F6F1FF', '#6548A3', 'none')
    endif

    hi clear DiffAdded
    hi clear DiffFile
    hi clear DiffNewFile
    hi clear DiffRemoved
    " For patch like format file, defined in runtime/syntax/diff.vim
    " Don't use bg, unlike vimdiff view, the bg color is not rendered in full width
    " in diff syntax (patch file)
    " diff headers
    hi! link DiffIndexLine Title
    hi! link DiffLine      Title
    hi! link DiffSubname   OneHue62
    hi! link DiffFile      Title
    hi! link DiffNewFile   OneHue4
    hi! link DiffOldFile   OneHue5
    " diff content
    hi! link DiffAdded   OneHue4
    hi! link DiffRemoved OneHue5
    hi! link DiffChanged OneHue2
    hi! link DiffComment Comment
  endif
endfunction

augroup vim_one_diff_group
  autocmd!
  autocmd VimEnter,ColorScheme * call OneDiffColor()
augroup END

Feedback is welcomed.

laggardkernel avatar Apr 23 '21 05:04 laggardkernel