Yes, there are many ways, here is one of them

So, you have great decimal number that fits in 3 Bytes (one for every ground color) and wish to know which is the separate value for each of them...

Imagine creature that has 256 fingers on his hands ;-), so his mathematic is based on 256 ... (we poor mankind work only with 10... ;-)

Thus we have to convert between our (10 based) and his (256 based) number system.

Are you fluent on doing this?

In case of: NO

The standart way of converting between number systems is:

1) Divide the number that have to be converted to the base (eg. our number has to be divided by 256)

2) take only the whole part from the division and multiply by the base (256)

3) Substract from the original number the result from 2), write the substraction result

4) do until the result from 2) is smaller than base (our case 256), otherwise your number gets the value of 1) (whole part from division by base) and loops to 1)

Since we know that the number we are looking for, has only 3 positions our problem is getting simple

make "for" cycle that loops 3 times, no need to check the conditions, save the results from the substraction, that is all.

Small example in BASIC:

DIM COLOR AS LONG

DIM I AS INT

DIM NUM1 AS LONG

DIM NUM2 AS LONG

COLOR=WhatSoEver 'REM Put value in the Color Var

FOR I=1 TO 3

NUM1=INT(COLOR/256)

NUM2=COLOR-NUM1*256 'REM NUM2 is what you are looking for

COLOR=NUM2

NEXT I

....

On each loop you will get one value; take care of the reverse order - BGR istead of RGB, first comes Blue, than Green and at least Red...

Hope this helps

Excuse me for the small joke

kind regards

Emil

----- Ursprüngliche Mail ----

Von: ibelcomputing <

[hidden email]>

An:

[hidden email]
Gesendet: Mittwoch, den 6. August 2008, 18:52:47 Uhr

Betreff: [plua] Know RGB from color index

My question is, exactly as title says, is there any way to know the R,

G and B values of a color given its index?

------------------------------------

Yahoo! Groups Links

__________________________________________________

Do You Yahoo!?

Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.

http://mail.yahoo.com