[Remind-Fans] Remind 04.01.00 BETA 1 is available

Tim Chase remind at tim.thechases.com
Fri Sep 16 21:56:30 EDT 2022


On 2022-09-17 00:42, Tim Chase via Remind-fans wrote:
> On 2022-09-16 20:01, Dianne Skoll via Remind-fans wrote:
> > - NEW FEATURE: remind: "remind -c" now supports the SHADE special.
> >  Works best with the 256-color extended XTerm palette or 24-bit
> >  true-color terminal escape sequences.
> 
> I couldn't get this one working with just a grayscale color.
> I created a file (ripped directly from the docs) with
> 
>   REM Sat Sun SPECIAL SHADE 128
>   REM Mon SPECIAL SHADE 255 0 0
>  
> and invoked it with
> 
>   $ ./remind -c - at 2,1,1 -f test_shade.rem
> 
> and it colored Mondays in red, but not the weekends in gray.
> 
> If I change that first one to
> 
>   REM Sat Sun SPECIAL SHADE 128 128 128
> 
> it works.

Here's a quick fix, largely cribbed from the rem2ps source.

-tim

$ git diff
diff --git a/src/calendar.c b/src/calendar.c
index 4d4089c..7d4bbd5 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -739,12 +739,18 @@ SetShadeEntry(int jul, char const *shade)
 {
     int y, m, d;
     int r, g, b;
+    int num;
     /* Don't bother if we're not doing SHADE specials */
     if (!UseBGVTChars) {
         return;
     }
 
-    if (sscanf(shade, "%d %d %d", &r, &g, &b) != 3) {
+    num = sscanf(shade, "%d %d %d", &r, &g, &b);
+    if (num == 1) {
+        g = b = r;
+        num = 3;
+    }
+    if (num != 3) {
         return;
     }
     if (r < 0 || g < 0 || b < 0 || r > 255 || g > 255 || b > 255) {


More information about the Remind-fans mailing list