LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   ncurses background color (http://www.linuxquestions.org/questions/programming-9/ncurses-background-color-88595/)

gtanghookup 09-02-2003 08:02 PM

ncurses background color
 
I have been working on a project using ncurses for the past several months, and I am wondering how to keep the background a certain color. The background color of the initial screen will start off being a color that I would like it to be. However, once the text has reached its limit at the bottom of the screen the background color is lost. That is, once the text has filled the initial screen and begins to "scroll" downward, the background color of the text is correct, however the background color of the rest of the screen is the default terminal color. I would like to have the entire screen one uniform background color without having the end of each line to the end of the terminal be different. I am thinking most of the problem lies in the fact that the text scrolls instead of being stationary. I obviously do not know the solution, but I would think there would be a function within the library to solve this. I have spent much time looking and tried several different functions to remedy this. If you could help I would appreciate it very much.
-Dan

jhorvath 09-02-2003 09:17 PM

have you tried something like :

Code:

#include <ncurses.h>

int main() {
    initscr();
    start_color();
    int i;


    /* this is my magic little line */
    assume_default_colors(COLOR_RED,COLOR_BLUE);

    for(i=0;i<2000;i++) {
        printf("%d\n\r",i)
        refresh();
    }

    endwin();
    return 0;
}

hope that's what you meant

[NOTE] i changed some of it above because before it was too hard to tell if the screen was actually scrolling (hard to tell when you print the same character or string of characters...so i used an incrementing integer) ...now it is definately visible [/NOTE]


All times are GMT -5. The time now is 10:14 AM.