What is the relation between hexadecimal value of a color and the color name in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the relation between hexadecimal value of a color and the color name in HTML?

22nd Apr 2018, 1:41 AM
Tanay Shirodkar
Tanay Shirodkar - avatar
3 Answers
+ 5
#RRGGBB first two values are intensity of red then green then blue. values range from 0-F. 0 is the lowest and F is the highest. Color names are specific but hex values you can define/change as you want.
22nd Apr 2018, 1:52 AM
Akib
Akib - avatar
+ 4
Each color name has a single unique hexadecimal equivalent. For example, tan is #d2b48c, orange is #ffa500, or lightblue is #add8e6.
22nd Apr 2018, 3:42 AM
John Wells
John Wells - avatar
+ 2
Combining both - A hex color palette provides 256*256*256 = 16 777 216 color combinations. So any programming language cannot provide all the names for all the colors. Thus these programming languages provide a limited number of colors with names, and rgba and hex values of the colors are encoded within the languages. Hex values range from 00 to FF, which is equivalent to decimal 0 to 255. RGB values use these decimal values. Both follow pattern Red Green Blue. Some color values provided in these languages Red = #FF0000 = rgb(255,0,0) Green = #00FF00 = rgb(0,255,0) Blue = #0000FF = rgb(0,0,255) Tan = #D2B48C = rgb(210,180,140) Orange = #FFA500 = rgb(255,165,0) Lightblue = #ADD8E6 = rgb(173,216,230) There are 2 more ways to define a color 1. CMYK - This coding is used for printing. The CMYK stands for Cyan, Magenta, Yellow and blacK (because B stands for Blue). It uses values between 0 to 100. 2. HSL - It uses the Hue, Saturation and Lightness attributes of the color. Hue is represented in degrees (n° - 0 to 360), whereas Saturation and Lightness is represented in percent (n% - 0.0 to 100.0). A variant of this coding, HSV, uses Value attribute, which is similar to lightness. This code might help you - https://code.sololearn.com/WzYi7lEMYR39/?ref=app
22nd Apr 2018, 8:26 AM
Rugved Modak
Rugved Modak - avatar