LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-02-2003, 07:02 PM   #1
gtanghookup
LQ Newbie
 
Registered: Sep 2003
Location: Portland, Oregon
Distribution: Debian and Gentoo
Posts: 27

Rep: Reputation: 15
Question 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
 
Old 09-02-2003, 08:17 PM   #2
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
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]

Last edited by jhorvath; 09-02-2003 at 08:36 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VI Background Text Color mahugl Linux - Newbie 3 12-15-2013 10:12 PM
How to Change the Cursor Color in Ncurses mac57 Programming 0 04-02-2005 03:01 PM
TTY background color! hitesh_linux Linux - General 1 09-17-2004 06:22 AM
get-background-color in GTK+-2.0 fromzj Programming 0 04-04-2004 03:46 AM
Is there a way to change background color out of X? purpleburple Linux - General 1 01-23-2003 08:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration