From 4922d25917ef73b7717e0ce5c144758f43caeaf2 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 16 Nov 2022 18:59:14 -0300 Subject: [PATCH] Add high-intensity colors option and cli flag. --- doc/MANUAL.html | 8 ++++++++ doc/w3m.1 | 3 +++ fm.h | 1 + main.c | 3 +++ rc.c | 2 ++ terms.c | 2 +- 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/MANUAL.html b/doc/MANUAL.html index 91a3485..550228a 100644 --- a/doc/MANUAL.html +++ b/doc/MANUAL.html @@ -105,6 +105,14 @@ insertions tagged with "mh 2016-03-29" and "mh 2016-06-11" come from the latest with no other target defined, use the bookmark page for startup

+
+ -H +
+
+

+ use high-intensity colors +

+
-M
diff --git a/doc/w3m.1 b/doc/w3m.1 index a0324e8..026f3b3 100644 --- a/doc/w3m.1 +++ b/doc/w3m.1 @@ -55,6 +55,9 @@ may take an argument. \fB\-B\fP with no other target defined, use the bookmark page for startup .TP +\fB\-H\fP +use high-intensity colors +.TP \fB\-M\fP monochrome display .TP diff --git a/fm.h b/fm.h index 25857f8..77f6f1a 100644 --- a/fm.h +++ b/fm.h @@ -957,6 +957,7 @@ global int override_user_agent init(FALSE); #ifdef USE_COLOR global int useColor init(TRUE); +global int highIntensityColors init(FALSE); global int basic_color init(8); /* don't change */ global int anchor_color init(4); /* blue */ global int image_color init(2); /* green */ diff --git a/main.c b/main.c index 45f5a4b..443fa70 100644 --- a/main.c +++ b/main.c @@ -219,6 +219,7 @@ fusage(FILE * f, int err) fprintf(f, " -v visual startup mode\n"); #ifdef USE_COLOR fprintf(f, " -M monochrome display\n"); + fprintf(f, " -H use high-intensity colors\n"); #endif /* USE_COLOR */ fprintf(f, " -N open URL of command line on each new tab\n"); @@ -630,6 +631,8 @@ main(int argc, char **argv) #ifdef USE_COLOR else if (!strcmp("-M", argv[i])) useColor = FALSE; + else if (!strcmp("-H", argv[i])) + highIntensityColors = TRUE; #endif /* USE_COLOR */ else if (!strcmp("-B", argv[i])) load_bookmark = TRUE; diff --git a/rc.c b/rc.c index 9fb08fb..7830c90 100644 --- a/rc.c +++ b/rc.c @@ -96,6 +96,7 @@ static int OptionEncode = FALSE; #define CMT_FOLD_TEXTAREA N_("Fold lines in TEXTAREA") #define CMT_DISP_INS_DEL N_("Display INS, DEL, S and STRIKE element") #define CMT_COLOR N_("Display with color") +#define CMT_HINTENSITY_COLOR N_("Use high-intensity colors") #define CMT_B_COLOR N_("Color of normal character") #define CMT_A_COLOR N_("Color of anchor") #define CMT_I_COLOR N_("Color of image link") @@ -467,6 +468,7 @@ struct param_ptr params1[] = { #ifdef USE_COLOR struct param_ptr params2[] = { {"color", P_INT, PI_ONOFF, (void *)&useColor, CMT_COLOR, NULL}, + {"high-intensity", P_INT, PI_ONOFF, (void *)&highIntensityColors, CMT_HINTENSITY_COLOR, NULL}, {"basic_color", P_COLOR, PI_SEL_C, (void *)&basic_color, CMT_B_COLOR, (void *)colorstr}, {"anchor_color", P_COLOR, PI_SEL_C, (void *)&anchor_color, CMT_A_COLOR, diff --git a/terms.c b/terms.c index e272aab..c751eed 100644 --- a/terms.c +++ b/terms.c @@ -1679,7 +1679,7 @@ static char * color_seq(int colmode) { static char seqbuf[32]; - sprintf(seqbuf, "\033[%dm", ((colmode >> 8) & 7) + 30); + sprintf(seqbuf, "\033[%dm", ((colmode >> 8) & 7) + (highIntensityColors ? 90 : 30)); return seqbuf; }