aboutsummaryrefslogtreecommitdiff
path: root/grab.c
diff options
context:
space:
mode:
Diffstat (limited to 'grab.c')
-rw-r--r--grab.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/grab.c b/grab.c
index 2b18167..e063f7d 100644
--- a/grab.c
+++ b/grab.c
@@ -329,10 +329,20 @@ cmdy(struct sv sv, struct ops ops, size_t i, const char *filename)
void
putm(struct sv sv, const char *filename)
{
+ static const char *fnc, *sepc;
+
+ if (!fnc) {
+ const char *s;
+
+ fnc = (s = getenv("GRAB_COLOR_FNAME")) && *s ? s : "35";
+ sepc = (s = getenv("GRAB_COLOR_SEP")) && *s ? s : "36";
+ }
+
if (fflag || filecnt > 1) {
- if (color)
- printf("\33[35m%s\33[36m%c\33[0m", filename, zflag ? '\0' : ':');
- else
+ if (color) {
+ printf("\33[%sm%s\33[%sm%c\33[0m", fnc, filename, sepc,
+ zflag ? '\0' : ':');
+ } else
printf("%s%c", filename, zflag ? '\0' : ':');
}
fwrite(sv.p, 1, sv.len, stdout);