View Full Version : CSS Colors Help!


cody
02-17-2005, 03:35 AM
Hey, this is a simple question for you guys and i hope that you will help me..

Numerical Values: rgb(89, 0, 127)

How to convert those numerical values to hexadecimals?

Answer: #59007F

My math really sucks and please do show me the method.

Dude128
02-17-2005, 03:51 AM
it's just converting from base 10 to base 16

in base 16 (hexadecimal), each position represents 16^n, rather than 10^n. so when you have 127, it's 1x10^2 + 2x10^1 + 7x10^0. to convert, divide it by 16, and you get 7 plus a remainder. so you have 7_ then you add the remainder, which is 15. since it's over 10, letters are used- A is 10, B is 11, C is 12, etc. 15 would be F, so now you have 7F- to check, 7x16^1 + 15x16^0 = 127.

you just do that for each color (red, green, and blue), and put them together.

cody
02-17-2005, 04:01 AM
Hmm...i wonder how you get 15..

Dude128
02-17-2005, 04:46 AM
what do you mean? the remainder?

divide by 16, you get 7 plus some more stuff. that takes care of 16*7=112. you have 127-112=15 left

pb&j
02-17-2005, 08:41 AM
color converter...

http://www.321webmaster.com/colorconverter.php

Dutch.American
02-17-2005, 09:25 AM
color converter...

http://www.321webmaster.com/colorconverter.php

...I couldn't have said it better myself. :D