Github messages for mblaze
 help / color / mirror / Atom feed
* [PR PATCH] mcolor: Add coloring support for diffs
@ 2023-10-05 13:59 thyssentishman
  2023-10-05 14:33 ` leahneukirchen
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: thyssentishman @ 2023-10-05 13:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

There is a new pull request by thyssentishman against master on the mblaze repository

https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/249

mcolor: Add coloring support for diffs
Add coloring for diffs sent as part of the email body. This adds support for the following three ENV variables:

- **MCOLOR_DIFF_I**: For (I)nserted lines.
- **MCOLOR_DIFF_D**: For (D)eleted lines
- **MCOLOR_DIFF_R**: For file (R)anges

Since the default theme is quite bright, these default to bright colors as well (Green1, Red1 and Yellow1 from the 256 XTerm colors respectively).

A patch file from https://github.com/leahneukirchen/mblaze/pull/249.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-249.patch --]
[-- Type: text/x-diff, Size: 1256 bytes --]

From 8dca80032e6fab9d2e656d8980a805c9e44abbeb Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 5 Oct 2023 15:39:46 +0200
Subject: [PATCH] mcolor: Add coloring support for diffs

---
 mcolor | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mcolor b/mcolor
index ba2c42c..9fff0c0 100755
--- a/mcolor
+++ b/mcolor
@@ -10,12 +10,16 @@ no_color { print; next }
 /^\014$/ { nextmail = 1; print(fg(co("FF",232), $0)); next }
 /^$/ { hdr = 0 }
 /^-- $/ { ftr = 1 }
-/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; sig = 0; next }
+/^diff -/ { diff = 1 }
+/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; diff = 0; sig = 0; next }
 /^-----BEGIN .* SIGNATURE-----/ { sig = 1 }
 nextmail && /^From:/ { hdr = 1 }
 hdr && /^From:/ { print so(fg(co("FROM",119), $0)); next }
 hdr { print fg(co("HEADER",120), $0); next }
 ftr { print fg(co("FOOTER",244), $0); next }
+diff && /^-/ { print fg(co("DIFF_D",196), $0); next }
+diff && /^\+/ { print fg(co("DIFF_I",46), $0); next }
+diff && /^@/ { print fg(co("DIFF_R",226), $0); next }
 /^-----BEGIN .* MESSAGE-----/ ||
 /^-----END .* SIGNATURE-----/ { print fg(co("SIG",244), $0); sig = 0; next }
 sig { print fg(co("SIG",244), $0); next }

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-10-05 15:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 13:59 [PR PATCH] mcolor: Add coloring support for diffs thyssentishman
2023-10-05 14:33 ` leahneukirchen
2023-10-05 14:36 ` leahneukirchen
2023-10-05 14:38 ` leahneukirchen
2023-10-05 15:24 ` [PR PATCH] [Updated] " thyssentishman
2023-10-05 15:24 ` thyssentishman
2023-10-05 15:34 ` leahneukirchen
2023-10-05 15:40 ` [PR PATCH] [Updated] " thyssentishman
2023-10-05 15:43 ` thyssentishman
2023-10-05 15:43 ` [PR PATCH] [Closed]: " leahneukirchen
2023-10-05 15:44 ` thyssentishman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).