Comments (11)
bat
is already using the fixed color.
I opened two terminals, one with white theme and one with dark theme.
In both terminals, #include
has a color #f92672
.
Here is delta:
The red line's foreground color is different (include #dddddd
vs #4d4d4c
)
The green line's foreground color is same (if #a71d5d
)
The other lines' foreground color is same (#333333
)
For the second issue, this can reproduce:
❯ cat diff
diff --git a/test.cc b/test.cc
index a6e4e99..7cb67e1 100644
--- a/test.cc
+++ b/test.cc
@@ -1,8 +1,9 @@
-#include <stdio.h>
+#include <cstdio>
-void main() {
- if(1) {
+int main() {
+ if(true) {
;
}
+ retunr 0;
}
git diff | delta --light --minus-color="#000000"
git diff | delta --light
from delta.
Hi @elbaro, there was another user having issues with alacritty recently. Is this relevant to your problem? #79 (comment)
from delta.
Also, can you confirm that the 24bit color tests linked in the README are passing for you? https://github.com/dandavison/delta#24-bit-color
from delta.
I tried out-of-box iTerm2 on Mac and Kitty on Linux, and the same problem happenes. The 24-bit color test works fine.
from delta.
OK, can you explain a bit more what the problem is exactly? In the screen shot above, it looks like you are using a light theme, but have a dark terminal background. Normally one would only use a light theme with a light terminal background. Sorry if I'm being slow! What exactly is the problem that the screenshot illustrates?
from delta.
Are you saying that to reproduce the screenshot in README.md, one has to use the terminal with #FFFFFF background? In the screenshot, the fonts in the red line is invisible. Can we have --ignore-term-color
for 24bit env to show the exact colors intended?
Also this may be a separate issue, but I am seeing a different behavior depending on the color:
git diff | delta --light --minus-color="#000000"
git diff | delta --light --minus-color="#111111"
from delta.
Are you saying that to reproduce the screenshot in README.md, one has to use the terminal with #FFFFFF background?
Yes, that's right, delta only applies the red and green background colors to convey diff information: it doesn't apply a "default" background color to all the text it emits. (Actually the screenshot is with iTerm2 "Material" theme which is some sort of pearl / off-white background).
Can we have --ignore-term-color for 24bit env to show the exact colors intended?
That could be possible. Am I right in thinking that this feature does not exist in bat and that it would be equally appropriate there?
I am seeing a different behavior depending on the color:
Can you post some raw output from git diff that is resulting in this behavior? (I.e. as text, not as a screenshot).
from delta.
Thank you! I can reproduce this; will look into it.
from delta.
@elbaro the color overrun bug you reported (git diff | delta --light --minus-color="#000000"
) is fixed in master. Thanks very much for reporting that. I know there are one or two remaining issues in this ticket though!
from delta.
Perhaps relevant to the other issues mentioned in here, I've merged a few branches in the last week that I believe improve the ways colors are handled internally, and improve the CLI for specifying colors. So to summarize what delta does and does not do (without any implication as to whether these are bugs or features!):
-
Delta allows the syntax highlighting theme specified by
--theme
or theBAT_THEME
env var to alter foreground colors of code. However, delta does not do this in the removed (red background) sections (to limit the color salad). In red sections you will be getting whatever foreground color is configured in your terminal emulator (This is the cause of one of the issues reported in this ticket). -
Delta applies 4 background colors to certain regions of code in diffs. Some regions of code do not receive a background color.
All color command line options can be specified either as explicit 24-bit RGBs, or as one of the 256 ANSI codes (see --help
). With the recent changes, delta will automatically choose an 8-bit approximation to any 24-bit colors when it detects an 8-bit color terminal environment.
The following text is now printed out at the end of the --help
text:
Colors
------
All delta color options work the same way. There are two ways to specify a color:
1. RGB hex code
An example of passing an RGB hex code is:
--file-color="#0e7c0e"
2. ANSI color name
There are 8 ANSI color names:
black, red, green, yellow, blue, magenta, cyan, white.
In addition, all of them have a bright form:
bright-black, bright-red, bright-green, bright-yellow, bright-blue, bright-magenta, bright-cyan, bright-white
An example is:
--file-color="green"
Unlike RGB hex codes, ANSI color names are just names: you can choose the exact color that each
name corresponds to in the settings of your terminal application (the application you use to run
command line programs). This means that if you use ANSI color names, and you change the color
theme used by your terminal, then delta's colors will respond automatically, without needing to
change the delta command line.
"purple" is accepted as a synonym for "magenta". Color names and codes are case-insensitive.
from delta.
@elbaro I believe all the issues you described here are finally fixed in master
. Please see the write-up in #205.
from delta.
Related Issues (20)
- 🐛 delta won't show diffs of files marked as autogenerated with `.gitattributes` even though they're text files HOT 3
- 🚀 Release filename without version HOT 1
- 🐛 Mouse scroll not working HOT 1
- Show filename when using `git blame -CCC` 🚀
- Commit hyperlink not working 🐛
- 🐛 git-grep path output is often replacing "/" with ":" HOT 1
- RUSTSEC-2023-0081: safemem is unmaintained
- 🐛 Delta doesn't highlight matches if `color.grep.match` changed
- Remove empty lines around filename 🚀
- 🐛 Possible race condition in delta testsuite with environment variable setting
- 🚀 Consider making README.md mention that color settings in .gitconfig can override delta's colors
- 🐛 Docu: Build instructions incomplete
- 🐛 Docu: Link to repo?
- 🐛 Delta on Windows doesn't use .gitconfig file HOT 1
- allow to completely omit zero ("same") lines (like `diff -U0` would do) HOT 6
- 🐛 Delta sometimes duplicates diff entries HOT 1
- 🐛 Colours different on different systems. HOT 1
- 🐛 Delta as `diffFilter` breaks keyboard input with `git add -p` in Git CMD HOT 12
- 🐛 delta fails to build with enabled `lto` HOT 1
- 🐛 Incorrect use of bright-black background with native less pager on Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delta.