-
Notifications
You must be signed in to change notification settings - Fork 5
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
Readability issues in recently added features, +config file? #47
Comments
Renamed files highlightingI think your terminal mistreats the ANSI SGR codes. The ANSI SGR codes say "Bold, then invert, then set green foreground color". It says nothing about grey. And green-on-black inverted should IMO become black-on-green, not grey-on-green (which is really ugly just as you point out). To verify this, I tried before-after.txt in both iTerm2 and the macOS terminal and with If we look at the first line of the
... we can see that the ANSI SGR codes are 1, 7 and 31. Wikipedia tells us these are bold, inverse and red respectively, and here's what this looks like in iTerm2. Note how the foreground becomes black when inverting, not grey as in your terminal. For this particular issue, I think you should report it to your terminal vendor. |
"Bold" is font bold and/or brighter colour depending on the terminal implementation and there is no actual standard as to which one to use so every terminal is going to do something different.
There's also no standard saying the bold attribute doesn't stay on the foreground after reverse video is applied, it is not defined as a singular "event" but an effect that applied to any text between it and the next bold-resetting code (0, 22, 21). Some terminals consider that reverse video switches the bold attribute over to the background, others keep it on both foreground and background. The only explicit and somewhat widely (but not universally) supported way to specify foregrounds and backgrounds with any mix of bright (not bold) and normal colours is the so-called "aixterm bright colours"; range 9x for bright foreground and range 10x for bright background. |
Makes sense, wanna do a PR for having the highlighted file name parts not being bold? |
This fixes part of walles#47
And on the topic of color blindness, if I need:
Do you have any suggestions for which colors I could use for added / removed? |
This is mostly by habit, since I am used to reading diffs with red - lines and green + lines, in the same way one gets to reading text in a given language (ie: english). I use riff to get highlighting for that language but when things like -+ lines are highlighted in ways that hide some of that information, I'm faced with a different "language". In detail, this is what happens when glancing at a "only additions" line:
Colour blindness is very varied; it can affect different cone types on the retina, and can be anywhere from mildly degraded perception/differentiation of some colours all the way to not being able to perceive an entire segment of the rainbow. What I have is partial degradation of red cones, which makes dark red almost identical to black, very bright (near hex The line is very clearly normal colour with a black on green reverse-video segment *My terminal allows customising faint colours, but it can't help much unless I make it very close to normal red
With what I have red/green highlighting for diffs still makes more sense so It's hard to personally recommend alternative colours. But a place to look is Github's colourblind themes. |
Of these this seems to me like the best option, but considering there's already a highlight for filename changed, maybe it could be just that, or combined with 2 (keep |
If a style system is added, I could see this being solvable with a style for
|
Wanna make a lowlight- I feel that having red/green in this case might be a bit misleading since the file name hasn't actually changed. |
Sure I can have a look
Diffs are traditionally highlighting removed lines as red and added lines as green even when not part of a modification pair, just like riff does, so I don't feel like it'd be much different with file names |
@walles would you be interested in a PR that adds a way (environment var like I think that could help with the colourblindness issue that 0x5c brings up, and allow users to choose colours that fit their preferences. Also, I think the only way to get decent highlighting on git combined diffs (other than just interpreting both |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
With this change in place, +++ and --- are now always bold so that people who are used to reading diffs can quickly spot the added and removed files. /dev/null is still lowlighted. Added files have their names prepended with the word "NEW". Removed files have their names prepended with the word "DELETED". Since adds / deletions aren't really name changes, I didn't want to use colors for highlighting new / deleted files. Let's see how this feels. Relates to #47.
Added/removed files highlightingHere's the updated flavor from the latest commit. I'm still unsure what would be the best thing here, but I do think this is an improvement. Inspired by (but not fully following) this comment: Both prefixes are now highlighted to aid vision (muscle?) memory.
New files have their names prefixed with NEW, and deleted files with DELETED. I opted for not using red / green since these aren't really changes. |
"Only additions" highlightI have now added a new command line option for this. And, Sorry for the long lead time @0x5c! I will close this issue now since it's become too much of a kitchen sink and the initial requests have been remedied to some extent. Do open new issues for things that still need fixing or things I forgot! |
Some of the new highlight features in recent-ish versions are creating readability issues for me (details further down). I see the value in those features, so I wouldn't advise removing them. I think the best approach is to make them configurable, either through enabled/disabled switches, or through the ability to specify the style to use for each "token" (for lack of a better word). This last approach would also double as a way to customise colours for colourblindness accessibility and personal preference. Configuration could be done using a config file and/or environment variables, the former being more user-friendly.
Renamed files highlighting
I like this way of highlighting renames, but dark grey on red/green is very hard to read. This one seems to simply be a bug; the foreground black being turned into "bright black" by the bright/bold modifier on the whole filename. Should be fixable by setting the foreground of the highlight area to no-bold. I'll try to make a fix for that one.
"Only additions" highlight
With this highlight, it becomes very hard to read the before line (especially with partial red-green colourblindness), which for me means that I can't easily parse the diff since I need both the + and - lines.
Added/removed files lowlighting
Similar to the problem with "only additions" highlight, this one makes it harder for me to process that a file has been deleted/added since the lack of the other line removes the comparison point. It's slightly less pronounced than "only additions" because of the colour, but still causes difficulty parsing.
The text was updated successfully, but these errors were encountered: