Google Answers Logo
View Question
 
Q: Decimal color coding ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Decimal color coding
Category: Computers > Software
Asked by: hlf-ga
List Price: $20.00
Posted: 17 Oct 2002 13:31 PDT
Expires: 16 Nov 2002 12:31 PST
Question ID: 77883
I have been "playing" with a java applet called tscroll. The source
and the compiled code are available at
http://www.javaside.com/asp/mus.asp?page=/us/tscroll.shtml
This applet uses decimal coding for the colors. I am familiar with
hexadecimal and decimal representations of hex. I have been unable to
figure out the color coding scheme used with this applet. By way of
example, 13693183 is a light blue,  14693183 is an orange-red, and
125501 is a bright green.
(There is a minor error in the explanation given in the html file -
text color and background color are reversed). I would like to know
how to correctly represent colors using the encoding scheme in the
applet.

Request for Question Clarification by websearcher-ga on 17 Oct 2002 13:54 PDT
Hi hlf: 

I am not quite certain what it is you need here. 

I have been able to decode the color scheme used for the decimal
numbers provided by you. That is, I know how the decimal values you
mention above can be converted into more traditional non-decimal (hex)
color values in order to get the colors you say those numbers
represent.

Are you looking for a way to translate from these decimal values to
the related hexidecimal values? Are you looking for the opposite
translation as well? Or are you looking for something more along the
lines of Java advice? I guess I'm asking - is this a math question or
a Java question?

Thanks!

websearcher-ga

Clarification of Question by hlf-ga on 17 Oct 2002 14:04 PDT
Thanks for the fast response. 

I want to know how to take a hexadecimal encoding of a color (for
example, red = ff0000) or its decimal equivalent 255,000,000 and
change it to the form used by the applet.
Answer  
Subject: Re: Decimal color coding
Answered By: websearcher-ga on 17 Oct 2002 14:34 PDT
Rated:5 out of 5 stars
 
Hi hlf:

Thank you for the speedy clarification. :-)

The decimal numbers that this applet uses are a decimal translation of
the hexadecimal RGB (Red, Green, Blue) values that typically represent
a color. For example, the RGB values for "light blue" are:

R: D0
G: F0
B: FF

What you need to do is concatenate those three values into a single
hexadecimal number:

Hex: D0F0FF

then convert that number to decimal:

Decimal: 13693183

These numbers can be substituted into the applet you are using.

How do you convert between hexadecimal and decimal? There's a good
tutorial on this at:

CONVERTING HEXADECIMAL TO DECIMAL 
http://www.permadi.com/tutorial/numHexToDec/index.html


One thing you need to keep clear is that the decimal numbers that this
applet uses *are not* found by concatenating each of the three
individual hexadecimal numbers first converted to decimal. You must
concatenate the hexadecimal numbers *before* you convert! The two
different procedures will yield two different values.

If you are given the three decimal RGB values (each between 0 and 255
inclusive), then you have to convert each of them to hexadecimal
first. For example, if you are given:

R: 224
G: 51
B: 63

as your three decimal color values, first translate them each to
hexadecimal:

R: E0
G: 33
B: 3F

then concatenate those three values into a single hexadecimal number:

Hex: E0333F

and convert that number to decimal:

Decimal: 14693183

This is the "orange-red" color you listed above. 

How to convert from decimal to hexadecimal?

CONVERTING DECIMAL TO HEXADECIMAL 
http://www.permadi.com/tutorial/numDecToHex/index.html

If you want to test out the color create by RGB values, try:

RGB Color Applet
http://www.freeprogrammingresources.com/color.html


I hope that I've hit on the information you are seeking. If I've
missed the mark at all or if you need any other clarification of the
information I have provided, please ask using the Clarification
feature and provide me with additional details as to what you are
looking for. As well, please allow me to provide you with
clarification(s) *before* you rate this answer.
   
Thank you.    
   
websearcher-ga   
   
 
Search Strategy:  
 
decimal color coding
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&safe=off&q=rgb+color+applet

java "hexadecimal to decimal" conversion
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&safe=off&q=java+%22hexadecimal+to+decimal%22+conversion

rgb color applet
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&safe=off&q=rgb+color+applet
hlf-ga rated this answer:5 out of 5 stars
Exactly what I was looking for. Fast and accurate.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy