Ncurses colors


 
Thread Tools Search this Thread
Top Forums Programming Ncurses colors
# 8  
Old 12-13-2014
Quote:
Originally Posted by Don Cragun
And, supporting wisecracker's suggestion, from the curs_color(3X) man page on OS X:
Code:
       Several caveats apply on  386  and  486  machines  with  VGA-compatible
       graphics:

       -    COLOR_YELLOW  is  actually brown.  To get yellow, use COLOR_YELLOW
            combined with the A_BOLD attribute.
       ... ... ...

I have to agree with the man page: the yellow is quite brown! Smilie But I disagree that it becomes anything else when combined with the A_BOLD attribute since all of my code uses A_BOLD everywhere.

It seems interesting that when I use YELLOW as a foreground color, it renders as a bright yellow, but when used as a background (even including the A_BOLD attribute), it renders as a muddy brown.

The same goes for COLOR_WHITE: it renders differently in foreground vs. background.

Seems like a pattern (i.e., foreground o.k., background muddy) until you look at COLOR_BLACK which renders as a medium grey in foreground, but a true dark black as background.
# 9  
Old 12-13-2014
Those foreground/background colours are a limited set of eight colours each; foreground can be set to bold or bright to give another eight. That's it.
What you can do on a capable terminal is the "set palette" ESC- sequence to assign other colour codes to those FG/BG colours: Try echo -e "\033]P7ffffff"; this should set your grey background to shining white.
# 10  
Old 12-13-2014
RudiC, can you give me some pointers to an ncurses description of "bright"? I can see the bold definition (A_BOLD) in the ncurses man pages, but haven't seen anything like "bright".

BTW:
On my system (Linux/Fedora20), I did a bit of checking. Ncurses says I have 256 colors and 256 color_pairs. I dumped the first 20 colors and got what you can see in the attachment below.

I was also able to get a bright white background by using color #15, but all attempts at getting a dark black for eth foreground failed and I am using color #19, a dark-ish blue. See the other attachment below.
Ncurses colors-selection_126png
Ncurses colors-selection_125png
# 11  
Old 12-13-2014
Have you tried setting the inverse video attribute?
A_REVERSE along with a combination of the other video attributes.
Just an idea...

EDIT:
Another suggestion...

How about writing a simple piece of code to display the colours available like I did for the shell one which I might add did not show two other loops to __cross__pollinate__ low number foreground and high number background and vice versa...

Last edited by wisecracker; 12-13-2014 at 09:34 AM.. Reason: See above...
# 12  
Old 12-13-2014
Please take a look. I think these screen shots are pretty self-explanatory. Also illustrative of what I am experiencing: black foreground with any background is washed out completely, all of the standard colors as background are muddy, and seem to worsen when a black foreground is used.
Ncurses colors-selection_128png
Ncurses colors-selection_129png
# 13  
Old 12-13-2014
Before going any further have you tried seeing if your terminal can create a bright white background along with black foreground, bold or normal?
An example using extended colours in some terminals.
Code:
#!/bin/bash
printf "\x1B[0;107m\x1B[2J\x1B[H"
printf "\x1B[30m           Print some text here...\n"

On OSX 10.7.5, default bash terminal this gives normal black on bright white background.
# 14  
Old 12-13-2014
Quote:
Originally Posted by wisecracker
Before going any further have you tried seeing if your terminal can create a bright white background along with black foreground, bold or normal?
An example using extended colours in some terminals.
Code:
#!/bin/bash
printf "\x1B[0;107m\x1B[2J\x1B[H"
printf "\x1B[30m           Print some text here...\n"

On OSX 10.7.5, default bash terminal this gives normal black on bright white background.
Yes, that works as expected. black fg and white bg.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question