256 colors, foreground and background

Posted by push.cx on Stack Overflow See other posts from Stack Overflow or by push.cx
Published on 2009-01-24T23:30:50Z Indexed on 2010/04/04 7:33 UTC
Read the original article Hit count: 352

Filed under:
|
|
|

This is a tale of two scripts and is related to a previous question.

The two scripts are at http://gist.github.com/50692. The ansi.rb script displays all 256 colors on all 256 background colors. The ncurses.rb script displays all 256 foreground colors but the background displays the basic 16 and then seems to cycle through various attributes like blinking and reverse video.

So what gives? Is this the bug in ncurses that it uses a signed integer for color pairs? (ie 'tput colors' says 256 but 'tput pairs' says 32767 instead 65536) It seems like if that were the case the first half of the colors pairs would display properly but the second half would repeat or get into the attributes as the int wraps.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about 256color