ncurses transparent console background

c, ncurses

Solution

If your application calls `use_default_colors`, ncurses (and NetBSD curses) provide an extension based on ECMA-48 SGR 39 and 49 "default colors". When you do this, ncurses refrains from explicitly coloring cells whose foreground and/or background color match its assumption about the terminal colors.

There is an additional function `assume_default_colors` which can be used to improve the default-colors feature where the terminal is (for example) using black text on a white background.

Most of the color-capable terminals you use support the SGR 39/49 codes, so the feature can be used most of the time.

Further reading:

- Default Colors

Problem

My console has transparency enabled, when I run other ncurses apps, I see the the background stays transparent. I'm trying to make my app keep the transparency and not apply a dark black opaque background. This is what I'm doing so far ``` start_color(); init_pair(1, COLOR_GREEN, COLOR_BLACK); attron(COLOR_PAIR(1)); mvprintw(10,10, "Hello"); refresh(); attroff(COLOR_PAIR(1)); ``` Any ideas? Thanks

Original source

Related problems