Skip to content

Use emacs diff colors#34

Open
Azkae wants to merge 2 commits intodandavison:masterfrom
Azkae:master
Open

Use emacs diff colors#34
Azkae wants to merge 2 commits intodandavison:masterfrom
Azkae:master

Conversation

@Azkae
Copy link
Copy Markdown

@Azkae Azkae commented Oct 4, 2025

Improve syntax highlighting by sending the emacs diff colors to delta.
This way, the colors should better match the user's theme/background.

This should also fix #28.

A few notes:

  • magit-delta-mode is now a global mode.

  • Since we are using diff faces, we need to have the correct faces already loaded when enabling magit-delta-mode. For example, if we enable magit-delta-mode before setting up a theme, we would use the wrong colors.

    Using (add-hook 'magit-mode-hook (lambda () (magit-delta-mode +1))) works since by the time we turn on magit mode, the faces should be correct.

I have also added magit-delta-max-size to avoid running delta on large files. It's easier to do now that magit-delta-mode is a global mode.
(I can move it to later PR if you prefer).

Before:

Screenshot 2025-10-04 at 13 54 25

After:

Screenshot 2025-10-04 at 15 26 10

@Azkae Azkae changed the title Better colors & limit size Use emacs diff colors Oct 10, 2025
@mmahmoudian
Copy link
Copy Markdown

@dandavison Would it be possible to push this PR forward. The current color scheme makes it hard to read the diff in magit, plus the magit-delta-max-size is very handy when dealing with Guix package files (although I wish it was introduced in a separate PR just for the sake of clarity).

Thank you @dandavison for both git-delta and magit-delta, and thank you @Azkae for the PR.

@dandavison
Copy link
Copy Markdown
Owner

Hi @Azkae and @mmahmoudian.

@Azkae thanks very much for this work! I have not been doing a good job recently keeping up with PRs and issues, but let me get this running locally and see if I encounter any issues.

@mmahmoudian thanks for the ping. Are you able to run this branch yourself locally to test it out, and to solve the problem for yourself at least?

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

Successfully merging this pull request may close these issues.

No easy way to disable

3 participants