Sponsored Content
Full Discussion: Ncurses colors
Top Forums Programming Ncurses colors Post 302928589 by ongoto on Saturday 13th of December 2014 03:18:17 AM
Old 12-13-2014
Hello BillLee
This is some code from a long time ago. Dont use C much anymore. If you're not using C this might not help. I hope it does though.
Code:
int
StartColors ()
{
  start_color ();

  init_pair (0, COLOR_WHITE, COLOR_BLACK);
  init_pair (1, COLOR_CYAN, COLOR_BLACK);
  init_pair (2, COLOR_WHITE, COLOR_BLUE);
  init_pair (3, COLOR_WHITE, COLOR_BLACK);
  init_pair (4, COLOR_WHITE, COLOR_RED);
  init_pair (5, COLOR_BLACK, COLOR_GREEN);
  /*
  init_pair (0, COLOR_WHITE, COLOR_BLACK);
  init_pair (DIR_NORM, COLOR_CYAN, COLOR_BLACK);
  init_pair (DIR_HI, COLOR_BLUE, COLOR_WHITE);
  init_pair (FIL_NORM, COLOR_WHITE, COLOR_BLACK);
  init_pair (FIL_HI, COLOR_RED, COLOR_WHITE);
  init_pair (5, COLOR_BLACK, COLOR_GREEN);
  init_pair (6, COLOR_MAGENTA, COLOR_BLACK);
  init_pair (7, COLOR_BLUE, COLOR_CYAN);
  init_pair (8, COLOR_RED, COLOR_BLACK);
  init_pair (9, COLOR_BLUE, COLOR_CYAN);
  init_pair (10, COLOR_GREEN, COLOR_BLACK);
  init_pair (12, COLOR_CYAN, COLOR_BLACK);
  init_pair (13, COLOR_BLUE, COLOR_WHITE);
  init_pair (14, COLOR_YELLOW, COLOR_CYAN);
  init_pair (15, COLOR_WHITE, COLOR_BLUE);
  init_pair (16, COLOR_YELLOW, COLOR_CYAN);
  init_pair (17, COLOR_BLUE, COLOR_WHITE);
  init_pair (18, COLOR_YELLOW, COLOR_RED);
  init_pair (19, COLOR_YELLOW, COLOR_BLACK);
  */

  return (0);
}



int
WbkgdSet (WINDOW * w, chtype c)
{
  if (has_colors ())
    {
      wbkgdset (w, c);
    }
  else
    {
      c &= ~A_BOLD;
      if (c == COLOR_PAIR (1) ||
      c == COLOR_PAIR (2) ||
      c == COLOR_PAIR (3) || c == COLOR_PAIR (4) || c == COLOR_PAIR (5))
    {

      wattrset (w, A_REVERSE);
    }
      else
    {
      wattrset (w, 0);
    }
    }
}

 

10 More Discussions You Might Find Interesting

1. Programming

ncurses/Darwin

I am using Darwin on Mac OS X.I.I (new to both Unix and C++). I downloaded the ncurses library from http://prdownloads.sourceforge.net/gnu-darwin/ncurses-5.2.tgz, but I don't know what to do with it now. Stuffit has expanded the archive, but I still have the original .tgz as well (if that's... (1 Reply)
Discussion started by: parmenides
1 Replies

2. Programming

ncurses -> the best way to use menus

hello there, i'm exploring the curses lib and i'm having some trouble with "defining a style". to clarify: i'm creating a menu driven app and i've been thinking what's the best way to use menus: make global vars (not my favourite), creating a function which designs the menu and returns the... (2 Replies)
Discussion started by: crashnburn
2 Replies

3. UNIX for Advanced & Expert Users

Using Ncurses for testing vi

Hi, Somebody has told me that NCurses can be used to test vi. But i was unable to figure out how. If anybody has done anything with NCurses please reply. Also is there any othre way by which we can test vi automatically? (2 Replies)
Discussion started by: rahulrathod
2 Replies

4. Programming

nCurses over telnet

hello all. my first post here :) i just want a little help. i have a small app tha uses ncurses for gui, and for user input. I need this app to be executed on a sever side, and have access to it through telnet. When i test it, i see that enter makes the hole gui move up, and some other... (0 Replies)
Discussion started by: tamtam
0 Replies

5. Linux

Ncurses with Ubuntu

Hi, I am new to this programming with ncurses. I want to work out few examples on this ncurses. I jus want to know whether this ncurses works with Ubuntu OS? I found tat ncurses doesn come with AIX OS, may be it could be installed as a SupportPac or something, not sure about it. Can u please... (4 Replies)
Discussion started by: julie_s
4 Replies

6. Programming

Help with ncurses

Help with ncurses Hi, I need some help with ncurses.I'm supposed to write a program in C to display date and time and also to input the username and password using C.I chose ncurses for my task and here I am. Code: #include <stdio.h> #include <termios.h> #include... (1 Reply)
Discussion started by: rakesh_01
1 Replies

7. UNIX for Dummies Questions & Answers

ncurses not in library?

I tried to complile a text-based messenger program but, while configuring, got a message saying that ncurses wasn't found. Though it appears to be there... This is the program: http://sourceforge.net/project/showfiles.php?group_id=110124&package_id=119574&release_id=373164 I get the error... (5 Replies)
Discussion started by: riwa
5 Replies

8. Programming

ncurses refresh()

i have read in one of links, there its documented but i am using following code int main () { char ch; initscr(); printw("Enter a char :"); ch=getch(); printw("You Entered '%c' ",ch); getch(); endwin(); return 0; } the code does... (2 Replies)
Discussion started by: MrUser
2 Replies

9. Programming

Memory sharing with NCURSES

Hey, Im using a shared memory segment to share a WINDOW structure among 2 processes. Basically I'm building a multi-player snake game in which multiple prrocesses access the window. The 'parent' process initializes the shared memory segment and puts the window in it. I can access and perform... (1 Reply)
Discussion started by: dgre0018
1 Replies

10. Programming

[C/Ncurses]Need help on a project

Hi guys I'm a newbie.Got a school project:need to convert Linux Hunt game,which is in K&R C to C99.I got some problems over Ncurses files:new library it's very different from the old one.There are some variables that with gcc are considered undefined 'cause they are no more used in the new Ncurses... (2 Replies)
Discussion started by: fracche
2 Replies
ncurses5-config(1)					      General Commands Manual						ncurses5-config(1)

NAME
ncurses5-config - helper script for ncurses libraries SYNOPSIS
ncurses5-config [options] DESCRIPTION
This is a shell script which simplifies configuring applications against a particular set of ncurses libraries. OPTIONS
--prefix echos the package-prefix of ncurses --exec-prefix echos the executable-prefix of ncurses --cflags echos the C compiler flags needed to compile with ncurses --libs echos the libraries needed to link with ncurses --version echos the release+patchdate version of ncurses --abi-version echos the ABI version of ncurses --mouse-version echos the mouse-interface version of ncurses --bindir echos the directory containing ncurses programs --datadir echos the directory containing ncurses data --includedir echos the directory containing ncurses header files --libdir echos the directory containing ncurses libraries --mandir echos the directory containing ncurses manpages --terminfo echos the $TERMINFO terminfo database path, e.g., /etc/terminfo --terminfo-dirs echos the $TERMINFO_DIRS directory list, e.g., /etc/terminfo:/lib/terminfo:/usr/share/terminfo --termpath echos the $TERMPATH termcap list, if support for termcap is configured. --help prints this message SEE ALSO
ncurses(3NCURSES) This describes ncurses version 5.9 (patch 20110404). ncurses5-config(1)
All times are GMT -4. The time now is 11:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy