256 Terminal Color Question ...

View: New views
3 Messages — Rating Filter:   Alert me  

256 Terminal Color Question ...

by Ben Duncan-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, am back on my PYapp project, and have been trying to figure something out.

init_color defines the palette RGB as a value between 0 and 1000.

I am looking at 256 Web Safe Colors chart and find out the RGB values.
The RGB values are listed in HEX as well as Decimal.

(see:  http://en.wikipedia.org/wiki/Web_colors )

My question is how do I convert those RGB values to the the
correct NUMERIC value value required by init_color to come out
the the color chart as listed?

Thanks as always ...


--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: 256 Terminal Color Question ...

by Mike Gran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Ben Duncan <bend@...>
> init_color defines the palette RGB as a value between 0 and 1000.
>
> I am looking at 256 Web Safe Colors chart and find out the RGB values.
> The RGB values are listed in HEX as well as Decimal.
>
> (see:  http://en.wikipedia.org/wiki/Web_colors )
>
> My question is how do I convert those RGB values to the the
> correct NUMERIC value value required by init_color to come out
> the the color chart as listed?

I know that for xterm on my box, the default colors don't use the
whole 0 to 1000 range.  White is set at R=680, G=680 B=680 or some-
thing like that.  I always assumed that they reserve the difference
between 680 and 1000 for 'bold', but, that's just a guess.  I know
for some non-xterm terminals, white is R=1000, G=1000, B=1000.

I think you could get a decent match by just multiplying
the decimal (0-255) values in the wikipedia table by 3.  That'd
put you from 0 to 785.  That way, you split the difference
between white=680/680/680 and white=1000/1000/1000 terminals.

The true answer to your question on how you match those colors
in the table exactly is going to be different for each terminal
or terminal emulator, I think.

-Mike



_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: 256 Terminal Color Question ...

by Ben Duncan-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, It looks like multiplying by 3.922 give me a
close enuff value to work with. Already reproducing
some pretty pretty MicroSoft colorization on some
xterm testing ...

Mike Gran wrote:
>> From: Ben Duncan <bend@...>
<SNIP>

>
> I know that for xterm on my box, the default colors don't use the
> whole 0 to 1000 range.  White is set at R=680, G=680 B=680 or some-
> thing like that.  I always assumed that they reserve the difference
> between 680 and 1000 for 'bold', but, that's just a guess.  I know
> for some non-xterm terminals, white is R=1000, G=1000, B=1000.
>
> I think you could get a decent match by just multiplying
> the decimal (0-255) values in the wikipedia table by 3.  That'd
> put you from 0 to 785.  That way, you split the difference
> between white=680/680/680 and white=1000/1000/1000 terminals.
>
> The true answer to your question on how you match those colors
> in the table exactly is going to be different for each terminal
> or terminal emulator, I think.
>
> -Mike
>
>


--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses