jart / bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
Other
443 stars 29 forks source link

Allow the hints callback to specify color #19

Closed dimkr closed 2 years ago

dimkr commented 2 years ago

This part of the example doesn't work, and hints use the default of gray foreground:

char *hints(const char *buf, const char **ansi1, const char **ansi2) {
    if (!strcmp(buf,"hello")) {                            
        *ansi1 = "\033[35m"; /* magenta foreground */
        *ansi2 = "\033[39m"; /* reset foreground */
        return " World";                                              
    }