mookid/diffr

I am not getting colors

Closed this issue · 10 comments

I am only getting bold text for all changes, no colors. Are there some term requirements? Or required options that I am missing? diff-highlight works fine (by default)

Hi @rjbell4,

What is your os/version? Requirements are supposed to be just windows >=7, or any osx/linux version.

Edit: and if on windows, are you using CMD.exe, git-bash/cygwin, or something else?

@mookid I'm running on CentOS. I'm connecting from a Windows machine using PuTTY.

I'm not getting colors either. The diff parts are just grey for me.

It's macOS 10.14.6 with the builtin Terminal.

@upsuper thanks for the report. I should be able to reproduce it.

@upsuper Does it work on iterm2?

I was able to reproduce it. It seems that asking for non-rgb colors works: does diffr --colors refine-added:background:green --colors added:foreground:green --colors refine-removed:background:red --colors added:foreground:green print any color?

As a temporay workaround, you can get a 16 colors version with:

diffr --colors refine-added:none:background:green --colors added:none:foreground:green --colors refine-removed:none:background:red --colors removed:none:foreground:red

reported BurntSushi/termcolor#21

I can confirm that I get colors with the workaround

As noted in BurntSushi/termcolor#21, it seems the problem is that diffr by default uses true color, which isn't widely supported (at least not in macOS's terminal).

I guess it may make sense to at least detect what colors the current terminal supports, and apply a default settings accordingly.

@upsuper 136b16f should make it work on most terminals.

Thanks again for the bug report!

@rjbell4 I won't bee able to reproduce your setup. Please let me know if there is any progress here.

@mookid thanks for the fix!

I can confirm that I get colors with the workaround

I did not see that message, sorry. Let's close for now and reopen if any issue appears again.