Giter Club home page Giter Club logo

Comments (11)

elbaro avatar elbaro commented on May 17, 2024 1

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.

dandavison avatar dandavison commented on May 17, 2024

Hi @elbaro, there was another user having issues with alacritty recently. Is this relevant to your problem? #79 (comment)

from delta.

dandavison avatar dandavison commented on May 17, 2024

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.

elbaro avatar elbaro commented on May 17, 2024

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.

dandavison avatar dandavison commented on May 17, 2024

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.

elbaro avatar elbaro commented on May 17, 2024

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"
image

git diff | delta --light --minus-color="#111111"
image

from delta.

dandavison avatar dandavison commented on May 17, 2024

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.

dandavison avatar dandavison commented on May 17, 2024

Thank you! I can reproduce this; will look into it.

from delta.

dandavison avatar dandavison commented on May 17, 2024

@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.

dandavison avatar dandavison commented on May 17, 2024

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 the BAT_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.

dandavison avatar dandavison commented on May 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.