Page MenuHome GnuPG

pinentry-curses disable colors
Open, NormalPublic

Description

Is it please possible to provide either a configure compile time switch or a runtime switch to disable colors in the pinentry-curses please ?

If it would be done compile time, USE_COLORS could be defined as (0) in pinentry-curses.c

But is there a configure switch for this ? (such as : configure --disable-colors)

--- a/pinentry/pinentry-curses.c
+++ b/pinentry/pinentry-curses.c
@@ -63,7 +63,8 @@
 #define STRING_NOTOK "<No>"
 #define STRING_CANCEL "<Cancel>"
 
-#define USE_COLORS             (has_colors () && COLOR_PAIRS >= 2)
+/* #define USE_COLORS          (has_colors () && COLOR_PAIRS >= 2) */
+#define USE_COLORS             (0)

I have tested the above modification to disable colors and this gives good results for me using classical curses.

However the same configure option could also be useful for ncurses users who do not wish to use colors.

Perhaps the option could also be set at runtime or in a gpg-agent.conf file. I am not certain that the best thing is to disable it at compile time.

Event Timeline

stes created this task.
gniibe triaged this task as Normal priority.Oct 15 2021, 2:27 AM
gniibe updated the task description. (Show Details)
gniibe added a project: pinentry.

After thinking a little more about this issue, I am of the opinion that the best option here is to provide a compile time configure option :

./configure --disable-colors or ./configure --enable-colors

The reason why a dynamic runtime option makes little sense is because there exist easy workarounds to set TERM=vt100 or TERM=sun and use some non-color TERM setting.

The option to compile pinentry-curses without color support makes it possible however to use pinentry-curses on TERM=sun-color or TERM=xterm-color without supporting colors (for example when used in combination with ./configure --disable-ncurses)