Colors 
Author Message
 Colors

I need to find out how to extract the Red, Green and Blue
components of a Windows color code.
I can create the code with the RGB system.
Example: RGB(255,255,0) is 65535 (Yellow).
How can I take the code 65535 and extract the Red, Green
and Blue componets?

Thank You,

Alfred M. Blanco



Mon, 29 Aug 2005 03:01:32 GMT  
 Colors
Hi Alfred,

In the windows color picker, if you select Define Custom Colors you can see
RGB as well as HSL values.

HTH
Steve C



Quote:
> I need to find out how to extract the Red, Green and Blue
> components of a Windows color code.
> I can create the code with the RGB system.
> Example: RGB(255,255,0) is 65535 (Yellow).
> How can I take the code 65535 and extract the Red, Green
> and Blue componets?

> Thank You,

> Alfred M. Blanco




Mon, 29 Aug 2005 04:50:10 GMT  
 Colors

Quote:
>-----Original Message-----
>Hi Alfred,

>In the windows color picker, if you select Define Custom
Colors you can see
>RGB as well as HSL values.

>HTH
>Steve C



>> I need to find out how to extract the Red, Green and
Blue
>> components of a Windows color code.
>> I can create the code with the RGB system.
>> Example: RGB(255,255,0) is 65535 (Yellow).
>> How can I take the code 65535 and extract the Red, Green
>> and Blue componets?

>> Thank You,

>> Alfred M. Blanco

>Steve: Thank you for your input.

In the time after I posted the message I figured out how
the windows color code is created by playing with it.
It is an exponential progression of powers of 256.
WindowsCode = Red*256^0 + Green*256^1 + Blue*256^2.
With this information I went about to what I call making
the chicken from the soup.
ChickenFromSoup = Divide the number by 256^2 Take the
integer part and that is your Blue component. Take the
fractional part of that number and multiply it by 256 and
again take the integer part of the number and that is your
Green component. The Red component is what is left after
you subtract the Blue and the Green components from the
original windows color code.

If you want to see the code send me an email and I will
send it to you if you want.

Thank you,

Alfred M. Blanco

- Show quoted text -

Quote:
>.



Mon, 29 Aug 2005 06:15:38 GMT  
 Colors

Quote:

>In the time after I posted the message I figured out how
>the windows color code is created by playing with it.
>It is an exponential progression of powers of 256.
>WindowsCode = Red*256^0 + Green*256^1 + Blue*256^2.
>With this information I went about to what I call making
>the chicken from the soup.
>ChickenFromSoup = Divide the number by 256^2 Take the
>integer part and that is your Blue component. Take the
>fractional part of that number and multiply it by 256 and
>again take the integer part of the number and that is your
>Green component. The Red component is what is left after
>you subtract the Blue and the Green components from the
>original windows color code.

Watch out for rounding and lack of precision in floating
point numbers.  I would do it this way:

red = thenumber And 255
green = (thenumber \ 256) And 255
blue = (thenumber \ 256^2) And 255

--
Marsh
MVP [MS Access]



Mon, 29 Aug 2005 14:43:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Outlook XP toolbar item colors (transparent color or index)

2. Using custom color from Color Palette

3. Is there any way to get true colors as backround colors in cells

4. Shape Fill Color vs. Cell Color

5. Logic to set font color with background color

6. Concatenate colored cells and preserve colors.

7. Determine color of SeriesLine when color set to xlAutomatic

8. Text Color and Back Color

9. How get a bigger Color pallete into access for more color choises

10. Colored borders print in black instead of correct color


 
Powered by phpBB® Forum Software © phpBB Group