Ask coding questions

← Back to all posts
ncurses color
h
Pankak (49)

What color standard does ncurses use? It has 257 different shades although the coverage is quite pathetic. init_color doesn't work for me so I'm limited to 257 eyerape shades for a CS project

I attached an image of all the colors it supports using plain init_pair

Answered by 19wintersp (1142) [earned 5 cycles]
View Answer
Comments
hotnewtop
Pankak (49)

@19wintersp hmm okay, my problem with that is the ncurses palette seems to be completely lacking the actual r/g/b variety, for example there is no brown (and similar colors which fall in between each rgb extreme, which was shown in the VGA example. There are some dark oranges but since it's so tilted to each extreme there really is only one shade of "brown", which is still polluted with green

19wintersp (1142)

@Pankak The issue is the way these colours are produced: they use escape sequences, which are not likely to change and made many years ago. You will only be able to use those 256 colours, because of technical limitations of the past. You can't specify an RGB value with the escape sequence.

Sorry ¯\_(ツ)_/¯

Pankak (49)

@19wintersp huh ncurses provides init_color which doesn't work for me for some reason, even though repl console has the ability to change the color

19wintersp (1142)

@Pankak init_color won't work everywhere; it uses something which not all terminals/interfaces support. See this SO question

Pankak (49)

@19wintersp notice my previous comment

even though repl console has the ability to change the color

can_change_color returns with true

19wintersp (1142)

@Pankak Read the second answer on the SO post.

there's basically no way to determine whether colors can be changed or not

They tested it, and can_change_color doesn't mean init_color will actually work.

JBloves27 (1903)

It looks like it uses the following colors: black, red, green, yellow, blue, magenta, cyan and white
I hope this helps!

Pankak (49)

@JBYT27 no I'm asking which color standard it uses

Pankak (49)

@JBYT27 then I guess I'll need someone more suited to this topic to respond