[Remind-Fans] Suppress reminder color codes in tkremind?

Tim Chase remind at tim.thechases.com
Thu Mar 24 10:50:33 EDT 2022


On 2022-03-24 08:17, Dianne Skoll via Remind-fans wrote:
> REM ... SPECIAL COLOR 0 255 0 Do the thing
> 
> and make sure to invoke remind with the "-@" flag

I use the above plus $DefaultColor pretty regularly, but sometimes I
also want to include color changes inside a reminder like

  REM Mar 13 2022 MSG %"Call [Red]Todd[nrm]%" about sales

In addition to the tkremind artifacts that Michael mentions, this also
throws off width-estimating in console calendar-mode because the ANSI
strings have length but aren't displayed.  To resolve this, I use a
c() function that is conditionally FSET based on a defined
variable 

  IF defined("COLOR")
    IF COLOR == 1
        FSET c(color) iif(color == Nrm, AnsiReset, Color256(color))
    ELSE
        IF COLOR == 2
            FSET c(color) iif(color == Nrm, AnsiReset, ColorTrue(color))
        ELSE
            FSET c(color) iif(color == Nrm, AnsiReset, ColorVT(color))
        ENDIF
    ENDIF
  ELSE
    FSET c(color) ""
  ENDIF

which lets me do

  SET Red "127 0 0"
  REM Mar 13 2022 MSG %"Call [c(Red)]Todd[c(Nrm)]%" about sales

It's minimally more typing but lets me easily toggle inline coloring.

Then I can invoke

  $ rem -iCOLOR=2 - at 2  # 24-bit color
  $ rem -iCOLOR=0 -@  # standard 16-color
  $ rem # no color

For simplicity, I have that wrapped in a shell alias/function

  $ alias 1='rem -g -q -iCOLOR=2 - at 2'
  $ alias 2='rem -g -q -iCOLOR=2 - at 2 "*2"'

so just typing "1" gets me today's agenda colorized.

I'd be glad to share my FSET for ColorTrue & ColorVT (the only two I
use, so that Color256 doesn't actually have an implementation yet)
which are mostly just a conversion of the internal functions that
Remind uses. :-)

-tim







More information about the Remind-fans mailing list