+ 2

Can anybody taught me how to convert rgb values into hexadecimal value.

27th Dec 2017, 4:40 PM
PULKIT DUBEY
PULKIT DUBEY - avatar
4 Antworten
+ 3
learn to convert decimal to hexadecimal conversion that's all it is.. for example u have seen for white color rgb is (255,255,255) its equivalent hexcode is #ffffff; as per the the decimal to hexadecimal conversion rule f stands for 15 in decimal and ff stands for 255 and the conversion process is as follows: ff= 15*16+15*1= 255 here 16 is the base value
27th Dec 2017, 4:54 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
the explanation behind my code: rgb values are base 10 numbers between 0 and 255. hexadecimal numbers are base 16 numbers between 0 and F where A=10 B=11....F=15 in base 10. if you think of it in a base 2 manner (binary) every value or rgb is coded on 8 bits between 0000 0000 and 1111 1111. and every hexadecimal number is coded on 4 bits. so each value of rgb is equivalent to 2 values of hexadecimal. now in order to convert from rgb to hexadecimal, you need to get the modulus (remainder of a division) of every value by 16 (ex 255 % 16) and then divide it by 16. if your rgb value is 15 or below, remember to put a 0 before the second number. for example: 20 % 16 = 4. 20/16 = 1. 1%16 = 1. so result from rgb value 20 in hex would be 14
16th Mar 2018, 1:22 AM
Dominique Abou Samah
Dominique Abou Samah - avatar
0
i also made a site using html css and javascript which can be used to help https://code.sololearn.com/WQ07xmADJTl5/?ref=app
16th Jan 2018, 8:51 PM
Brennan Woodroof
Brennan Woodroof - avatar
16th Mar 2018, 1:16 AM
Dominique Abou Samah
Dominique Abou Samah - avatar