-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: Configure ANSI background colors separately #11830
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
feat: Configure ANSI background colors separately #11830
Conversation
Enable the routine to print the ANSI terminal colors also in release builds. The colors are used to display e.g. git-diff. The colors are printed by setting the environment variable GIT_EXTENSIONS_CONSOLE_COLORS, seen in "Search files in commit" (git-grep) results.
c9dbaa5
to
8d7d47b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Haven't run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 LGTM, have not reviewed in detail
Specify foreground/background colors for the terminal separately, to enable themes that work better with GE colors. Apply theme colors for difftastic: Do not change background for bold text, to improve readability. Only reverse video for normal red/green.
Adjust the ANSI terminal colors to align with the GE theme. The background/foreground colors are separate to improve the display for the extremely bright GE colors. The theme is somehow based on mintty Helmhotz, but heavily modified especially for background (reverse video) to align with the existing GE theme colors.
If GE theme colors are applied, set moved lines as reverse video (colored background) to match the appearances
fc4a6a3
to
21e6752
Compare
…textensions#11830) Try to keep the current linenumber when switching to a new commit in file tree, instead of always resetting to first line.
Use the AnsiTerminal colors directly
21e6752
to
e850eeb
Compare
There are still some potential palette issues. GetForeColorForBackColor() tries to get a color from some pairs, using HSL perceived luminance, that is obviously not always the best. The pairs checked looks like this: |
Supersedes #11824
Fixes #11821
Proposed changes
This PR has four serial parts, the last commit could be dropped.
Enable the routine to print the ANSI terminal colors also in release builds.
The colors are used to display e.g. git-diff.
Specify foreground/background colors for the terminal separately,
to enable themes that work better with GE colors.
Apply theme colors for difftastic: Do not change background
for bold text, to improve readability.
Only reverse video for normal red/green.
Adjust the ANSI terminal colors to align with the GE theme.
The background/foreground colors are separate to improve the
display for the extremely bright GE colors.
The theme is somehow based on mintty Helmhotz, but heavily modified
especially for background (reverse video) to align with the
existing GE theme colors.
If GE theme colors are applied, set moved lines as
reverse video (colored background) to match the appearances
Screenshots
Yellow foreground is still not great, but not much used by git-diff

The background (reverse) are to most used with the last commit
Before
no reverse video
reverse video
Not convinced that this is better, but maybe more predictable
Difftastic
Visibility is still not great, that need to be handled in difftastic itself
Test methodology
Tests are updated
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.