Commit Diff


commit - 923f9ce5257203206ad6ed12b05f7d1576eb1ab0
commit + 2c748a1f1ea6ec51c321712170e1a7df470300a7
blob - dc7758ff523df9b7dcce4e2fe2c683b0a7a1eb64
blob + 41556a907a31f1f5108bf0b97774b4c7c2a66cbb
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,7 @@
+2021-06-21  Omar Polo  <op@omarpolo.com>
+
+	* defaults.c (config_setvari): add enable-colors (variable)
+
 2021-06-20  Omar Polo  <op@omarpolo.com>
 
 	* cmd.c (cmd_end_of_buffer): fix end-of-buffer glitch
blob - 191a8f096e565dcdb171040e3529b61efb72327d
blob + b4ebfe7a8d6975644cdd3dae99905bcae3f81dff
--- defaults.c
+++ defaults.c
@@ -24,6 +24,7 @@
 char *new_tab_url = NULL;
 int fill_column = INT_MAX;
 int olivetti_mode = 0;
+int enable_colors = 1;
 
 struct lineprefix line_prefixes[] = {
 	[LINE_TEXT] =		{ "",		"" },
@@ -115,8 +116,12 @@ config_setvari(const char *var, int val)
 			fill_column = INT_MAX;
 	} else if (!strcmp(var, "olivetti-mode")) {
 		olivetti_mode = !!val;
-	} else
+	} else if (!strcmp(var, "enable-colors")) {
+		enable_colors = !!val;
+	} else {
 		return 0;
+	}
+
 	return 1;
 }
 
blob - d14d362df283b979faa4c9c102b6359de8561e48
blob + 570180e6ae1888185c5491f616c986477f40ba34
--- telescope.1
+++ telescope.1
@@ -476,6 +476,12 @@ to the value
 Valid options are:
 .Pp
 .Bl -tag -width twelveletters -compact
+.It enable-colors
+.Pq integer
+If not zero, enable colours.
+By default is 1 if
+.Ev NO_COLORS
+is not set, 0 otherwise.
 .It fill-column
 .Pq integer
 If greater than zero, lines of text will be formatted in a way that
blob - b2fda67e5ed87f070bdd5c087176db0c911d9125
blob + 08426d4379566afea160723636d8718dbd5ee49c
--- telescope.h
+++ telescope.h
@@ -61,6 +61,7 @@ enum imsg_type {
 extern char	*new_tab_url;
 extern int	 fill_column;
 extern int	 olivetti_mode;
+extern int	 enable_colors;
 
 struct lineprefix {
 	const char	*prfx1;