Change color of stdin in C (like in fish shell)

Have a look at here and here.

I think this Sample Code should help you,


int main()
    int num;
    printf("%s", "\033[92mEnter Number : \033[34m");
    scanf("%d", &num);
    printf("%s", "\033[0m");
    return 0;

Above coe will print Enter number : in green and typing number in blue,

Note : Make sure that your terminal supports ANSI escape color code see here for windows 10.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top