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

Unexpected colors with default settings #324

Closed
FatBoyXPC opened this issue Feb 13, 2019 · 17 comments
Closed

Unexpected colors with default settings #324

FatBoyXPC opened this issue Feb 13, 2019 · 17 comments

Comments

@FatBoyXPC
Copy link

I'm not sure if it's something on my system that changed or if it's this package, but I updated a couple weeks ago and haven't been able to get the good colors back.

I'm on Arch and have version 1.2.5-1 of diff-so-fancy.

It's important to note that when I first set this up with my gitconfig that I didn't add the diff highlight colors and such because it broke them in a similar way to how it is now. The diff highlight settings in my gitconfig still break it in that way (I get more greys with that than I do without the color settings).

Here are my term related env vars:

➜  dotfiles git:(master) ✗ env | ag term
COLORTERM=truecolor
TERM=xterm-256color
➜  dotfiles git:(master) ✗ 

I use termite terminal with a solarized theme.

Here's a screenshot of what I see:
image

@scottchiefbaker
Copy link
Contributor

Can you define what you consider "broken" in the image. It looks OK to me, but maybe you're expecting different colors?

@FatBoyXPC
Copy link
Author

Broken as in the colors are the wrong color. It used to be red text with red highlight and green text with green highlight by default. When I added the colors into my gitconfig it did something similar to this but with more grey. Now I get some grey colors again but if I put the colors in my gitconfig I get even more grey :(

@scottchiefbaker
Copy link
Contributor

Nothing should have changed with regards to the colors in the new version. Have you tried and older version of d-s-f to see if it is still an issue.

It's more likely there was a terminal update, or a git update that changed the default colors.

@FatBoyXPC
Copy link
Author

Yeah, I get more vte and termite updates than I do dsf updates, but I figure this is worth investigating here since the colors in the gitconfig don't work, either.

@scottchiefbaker
Copy link
Contributor

You make any progress on this?

@FatBoyXPC
Copy link
Author

Nope - whenever I follow the colors guide in the README I get even worse colors. I don't really have much of an idea where to start.

@scottchiefbaker
Copy link
Contributor

I'd start by trying a different terminal. My guess it the terminal is mapping around those colors behind your back. Also can you run this script and post the output:

https://github.com/scottchiefbaker/perl-git-prompt/blob/master/utils/term-colors.pl

That should output all 256 colors of your terminal. If it looks wonky it could be because your terminal doesn't fully support 256 colors?

@scottchiefbaker
Copy link
Contributor

mental note: Add term-colors.pl to the third-party directory of d-s-f

@scottchiefbaker
Copy link
Contributor

Output should look something like this:

256-color-pallet

@FatBoyXPC
Copy link
Author

My terminal supports 256 color and true color, but it looks to be something with the way my solarized config for termite works.

I definitely have a few noticeable differences when I run that script:

image

Looking at my termite config, I see this in the bottom:

## The following was copied from solarized-dark
# Solarized dark color scheme

[colors]
foreground = #839496
foreground_bold = #eee8d5
#foreground_dim = #888888
background = #002b36
cursor = #93a1a1

# if unset, will reverse foreground and background
#highlight = #839496

# colors from color0 to color254 can be set
color0 = #073642
color1 = #dc322f
color2 = #859900
color3 = #b58900
color4 = #268bd2
color5 = #d33682
color6 = #2aa198
color7 = #eee8d5
color8 = #002b36
color9 = #cb4b16
color10 = #586e75
color11 = #657b83
color12 = #839496
color13 = #6c71c4
color14 = #93a1a1
color15 = #fdf6e3

It looks like these map to the 0-255 values in the image above. When I compare #073642 from color0 to the screenshot above, that looks like a pretty similar color.

It looks like I'm able to specify a numerical value for the color (I was guessing I could do this since I saw "red bold 52") so I'll just look at my personal output of that script and use the colors that work for my solarized setup.

Thank you so much for the help! That perl script was super helpful!

@FatBoyXPC FatBoyXPC changed the title Recent change broke colors Unexpected colors with default settings Feb 17, 2019
@FatBoyXPC
Copy link
Author

Just FYI, I edited the title for 2 reasons: 1) it ended up being inaccurate, 2) hopefully if other people run into a similar issue as me they can use this thread as a troubleshooting guide.

@FatBoyXPC
Copy link
Author

Actually, one more question: is there a way for me to map color values within d-s-f but not in the gitconfig? I like d-s-f so much that I wrote this shell function:

dsf () {
	diff -u --color=always "$@" | diff-so-fancy | less "$LESS"
}

The output in diff -u is normal, but once it's piped into d-s-f I get some greying of the green again. I realize this is made for git, but it's super handy for regular diffs, too!

@scottchiefbaker
Copy link
Contributor

@FatBoyXPC glad you were able to solve your problem.

No there is no way to specify colors raw in d-s-f, all the colors are read from .gitconfig. I mean you could hack the script to use specific colors and not read them from the config. But there is no "official" way to do this.

@FatBoyXPC
Copy link
Author

I'm kind of surprised it doesn't "just work" since my git config values are still accessible. When I run git config --list (I chose this because this is what git_config_raw() is doing), I still see the color values I've set:

color.ui=true
color.diff-highlight.oldnormal=196 bold
color.diff-highlight.oldhighlight=196 bold 52
color.diff-highlight.newnormal=34 bold
color.diff-highlight.newhighlight=34 bold 22
color.diff.meta=130
color.diff.frag=33 bold dim
color.diff.commit=172 bold
color.diff.old=196 bold
color.diff.new=34 bold
color.diff.whitespace=red reverse

Any ideas why my dsf() function might not work as expected? I see some of the other colors, like the meta, but frag is not the normal color, either. Here's what I mean:

image

Also, notice the "renamed:" being gred/green bit. I can get over that, though, I just thought it was strange.

@scottchiefbaker
Copy link
Contributor

d-s-f support for vanilla diffs is still a work in progress. #220 is the beginning of addressing that. If you're still having issues I suggest opening another issue.

@FatBoyXPC
Copy link
Author

Oh, sick! I'll try the --no-index trick and keep an eye on that issue, thanks!

@eddy-geek
Copy link

In kde's konsole I had to change the Solarized theme in a similar way -- the only color I changed is obvious 😉 :
image

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

No branches or pull requests

3 participants