Re: color codes

Author: Gérard Lochon

Posted: 2013-09-06 at 17:16:51

----- Original Message -----

From: "Rafael Copquin" <rcopquin@fibertel.com.ar>

To: <profoxtech@leafe.com>

Sent: Wednesday, September 04, 2013 8:49 PM

Subject: color codes

>I need to create a table with color codes.

>

> I wonder how are the numbers obtained. I do not want to use the RGB

> function and I saw somewhere an algorithm or a function that gives those

> numbers.

> How?

>

> Rafael Copquin

Hello Rafael.

The color_number and rgb(red,green,blue) values are related :

if you concatenate the hexadecimal values of the red, green and blue

components,

the result is the hexadecimal value of the color_number.

Color number => rgb() :

red = BITAND(0xff,color_number)

green = BITAND(0xff,BITRSHIFT(color_number,8))

blue = BITAND(0xff,BITRSHIFT(color_number,16))

Rgb() => color number :

color_number = BITOR(red,BITLSHIFT(green,8),BITLSHIFT(blue,16))

You can find the different values here :

http://en.wikipedia.org/wiki/List_of_colors_%28compact%29

(better use in spanish or french pages)

Gérard.

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/89533FA9E0AE4EC88ACF6CA7456486A7@MuriellePC

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2013 Gérard Lochon