Academic Block

Academic Block logo
HTML Tutorial

HTML Colors

HTML Color Formats

HTML supports named colors like “gold” or “lightgreen,” as listed in the html colors chart. Secondly, you can use Hex color values (e.g. #FFD700 for gold hex colors) or rgb() functions (e.g. rgb(0, 0, 255) for blue). Finally, CSS also accepts RGBA for transparency.

1. HTML Color Names and Charts

HTML color names such as “gold” or “salmon” make it easy to remember your palette. HTML Color Names are predefined, human-readable labels that map to exact hexadecimal RGB values. They ensure consistent rendering across all browsers without needing to memorize complex hex colors code like #FFD700 for gold. We can see some HTML Color name below:

Red Green Blue Gold
LightPink OliveDrab LightGreen Orange
Purple Teal SteelBlue DeepPink
SeaGreen White OrangeRed DodgerBlue
SlateGray GoldenRod Black LightGray

You can generate similar color palette using the HTML Color Names, as shown below:

<table style="width:100%; border-collapse: collapse;">
  <tr>
    <td style="background-color:#FF0000;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">Red </td>
    <td style="background-color:#DC143C;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">Crimson </td>
    <td style="background-color:#B22222;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">FireBrick </td>
    <td style="background-color:#8B0000;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">DarkRed </td>
    <td style="background-color:#FA8072;color:#000000;height:80px; width: 20%; text-align:center;border:3px solid white;">Salmon </td>
  </tr>

<tr>
  <td style="background-color:#008000;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">Green </td>
  <td style="background-color:#006400;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">DarkGreen </td>
  <td style="background-color:#228B22;color:#FFFFFF;height:80px; width: 20%; text-align:center;border:3px solid white;">ForestGreen </td>
  <td style="background-color:#32CD32;color:#000000;height:80px; width: 20%; text-align:center;border:3px solid white;">LimeGreen </td>
  <td style="background-color:#00FF7F;color:#000000;height:80px; width: 20%; text-align:center;border:3px solid white;">SpringGreen </td>
</tr>

</table>

2. Coloring Paragraph Text

In HTML, coloring paragraph text can be done easily using the <style> attribute with the color property to apply a specific font color. Using the example below you can change the color of any text.

<!DOCTYPE html>
<html>
  <head>
    <style>
      .highlight-text { color: #6B8E23; }  /* common CSS html css colors */
    </style>
  </head>
  <body>
    <p style="color: #0000FF;">This uses inline blue rgb code (#0000FF).</p>
    <p class="highlight-text">This uses a CSS class for color font html code.</p>
  </body>
</html>
        

3. Coloring Text with Gradients

In HTML, you can create stylish gradient effects on text using CSS linear-gradient and text clipping. You can use example below for understanding both inline styling and a reusable CSS class.

<!DOCTYPE html>
<html>
  <head>
    <style>
      .gradient-text {
        background: linear-gradient(to right, #f12711, #f5af19);
        -webkit-background-clip: text;
        color: transparent;  /* apply gradient to text */
      }
    </style>
  </head>
  <body>
    <h1 style="background: linear-gradient(to right, #6a11cb, #2575fc);
               -webkit-background-clip: text;
               color: transparent;">
      This inline-styled text shows a blue–purple gradient.
    </h1>
    <h2 class="gradient-text">
      This text uses a CSS class for an orange–yellow gradient.
    </h2>
  </body>
</html>
  

4. Backgrounds and Borders

In HTML, you can style backgrounds and borders using the <style> attribute with properties like <background-color> for backgrounds and <border> for borders to enhance the visual appeal of elements.

<!DOCTYPE html>
<html>
  <head>
    <style>
      .bg-pink { background-color: #FFB6C1; }
      .border-gold { border: 4px solid #FFD700; }
    </style>
  </head>
  <body>
    <div style="background-color:#90EE90; padding:20px;">
      Inline background (hex colors code).
    </div>
<br>
    <div class="bg-pink border-gold" style="padding:20px;">
      CSS background and gold hex colors border.
    </div>
  </body>
</html>
        

5. Dynamic Color Box with Buttons

A Dynamic Color Box with Buttons lets users interactively change an element’s background color by clicking buttons that apply different HTML color codes via JavaScript. You can also try another color codes below:

<!DOCTYPE html>
<html>
  <body>
    <div style="display:flex; flex-direction:column; align-items:center;">
      <div id="colorBox" style="width:100px;height:100px;background-color:#FFD700;margin-bottom:10px;"></div>
      <button onclick="document.getElementById('colorBox').style.backgroundColor='#FF0000'" >Red</button> <br>
      <button onclick="document.getElementById('colorBox').style.backgroundColor='rgb(0,128,0)'">Green</button> <br>
      <button onclick="document.getElementById('colorBox').style.backgroundColor='rgba(0,0,255,0.7)'">Semi‑Transparent Blue</button>
    </div>
  </body>
</html>
        

6. Using the Browser’s Color Picker

The Browser’s Color Picker example demonstrates how users can select any color with <input type=”color”> and instantly display its corresponding hash color code in your HTML.

<!DOCTYPE html>
<html>
  <body>
<div style="display:flex; flex-direction:column; align-items:center;">
 <p>Click on the color box to choose different color.</p>
    <input type="color" id="picker" value="#FF0000"style= "height: 90px; width: 180px; "> <br>
    <input type="text" id="colorCode" readonly placeholder="Hash color code">
    <script>
      document.getElementById('picker').addEventListener('input', function() {
        document.getElementById('colorCode').value = this.value;
      });
    </script>
 </div>
  </body>
</html>
        

HTML Color Selector

This HTML Color Selector allows users to pick colors from a interactive color input field. Upon selection user also get nearby 8 shades of colors as suggestion.

🌈 Color Picker

#FF0000
Color copied!

HTML Color Table

This HTML color table offers an intuitive visual guide to standardized web-safe colors, displaying each hue alongside its name, HEX code, and RGB values.

View Color
Color Name
HEX Code
RGB Value
LightSalmon
#FFA07A
rgb(255,160,122)
LightCoral
#F08080
rgb(240,128,128)
Salmon
#FA8072
rgb(250,128,114)
DarkSalmon
#E9967A
rgb(233,150,122)
Coral
#FF7F50
rgb(255,127,80)
RosyBrown
#BC8F8F
rgb(188,143,143)
PaleVioletRed
#DB7093
rgb(219,112,147)
Tomato
#FF6347
rgb(255,99,71)
IndianRed
#CD5C5C
rgb(205,92,92)
OrangeRed
#FF4500
rgb(255,69,0)
Red
#FF0000
rgb(255,0,0)
Crimson
#DC143C
rgb(220,20,60)
FireBrick
#B22222
rgb(178,34,34)
Brown
#A52A2A
rgb(165,42,42)
DarkRed
#8B0000
rgb(139,0,0)
Maroon
#800000
rgb(128,0,0)
Black
#000000
rgb(0,0,0)
Ivory
#FFFFF0
rgb(255,255,240)
LightYellow
#FFFFE0
rgb(255,255,224)
Cornsilk
#FFF8DC
rgb(255,248,220)
Beige
#F5F5DC
rgb(245,245,220)
LemonChiffon
#FFFACD
rgb(255,250,205)
LightGoldenRodYellow
#FAFAD2
rgb(250,250,210)
PaleGoldenRod
#EEE8AA
rgb(238,232,170)
Khaki
#F0E68C
rgb(240,230,140)
GreenYellow
#ADFF2F
rgb(173,255,47)
DarkKhaki
#BDB76B
rgb(189,183,107)
Chartreuse
#7FFF00
rgb(127,255,0)
Gold
#FFD700
rgb(255,215,0)
Yellow
#FFFF00
rgb(255,255,0)
YellowGreen
#9ACD32
rgb(154,205,50)
LawnGreen
#7CFC00
rgb(124,252,0)
OliveDrab
#6B8E23
rgb(107,142,35)
DarkOliveGreen
#556B2F
rgb(85,107,47)
Olive
#808000
rgb(128,128,0)
AliceBlue
#F0F8FF
rgb(240,248,255)
Azure
#F0FFFF
rgb(240,255,255)
LightCyan
#E0FFFF
rgb(224,255,255)
PaleTurquoise
#AFEEEE
rgb(175,238,238)
PowderBlue
#B0E0E6
rgb(176,224,230)
LightBlue
#ADD8E6
rgb(173,216,230)
LightSteelBlue
#B0C4DE
rgb(176,196,222)
LightSkyBlue
#87CEFA
rgb(135,206,250)
SkyBlue
#87CEEB
rgb(135,206,235)
CornflowerBlue
#6495ED
rgb(100,149,237)
RoyalBlue
#4169E1
rgb(65,105,225)
Turquoise
#40E0D0
rgb(64,224,208)
DodgerBlue
#1E90FF
rgb(30,144,255)
MediumTurquoise
#48D1CC
rgb(72,209,204)
LightSlateGray
#778899
rgb(119,136,153)
SlateGray
#708090
rgb(112,128,144)
Aqua
#00FFFF
rgb(0,255,255)
CadetBlue
#5F9EA0
rgb(95,158,160)
Cyan
#00FFFF
rgb(0,255,255)
DeepSkyBlue
#00BFFF
rgb(0,191,255)
SteelBlue
#4682B4
rgb(70,130,180)
LightSeaGreen
#20B2AA
rgb(32,178,170)
DarkTurquoise
#00CED1
rgb(0,206,209)
DarkCyan
#008B8B
rgb(0,139,139)
Teal
#008080
rgb(0,128,128)
DarkSlateGray
#2F4F4F
rgb(47,79,79)
DarkOrange
#FF8C00
rgb(255,140,0)
Orange
#FFA500
rgb(255,165,0)
GoldenRod
#DAA520
rgb(218,165,32)
Chocolate
#D2691E
rgb(210,105,30)
Sienna
#A0522D
rgb(160,82,45)
DarkGoldenRod
#B8860B
rgb(184,134,11)
SaddleBrown
#8B4513
rgb(139,69,19)
Snow
#FFFAFA
rgb(255,250,250)
LavenderBlush
#FFF0F5
rgb(255,240,245)
MistyRose
#FFE4E1
rgb(255,228,225)
Pink
#FFC0CB
rgb(255,192,203)
LightPink
#FFB6C1
rgb(255,182,193)
MintCream
#F5FFFA
rgb(245,255,250)
HoneyDew
#F0FFF0
rgb(240,255,240)
PaleGreen
#98FB98
rgb(152,251,152)
Aquamarine
#7FFFD4
rgb(127,255,212)
LightGreen
#90EE90
rgb(144,238,144)
DarkSeaGreen
#8FBC8F
rgb(143,188,143)
MediumAquaMarine
#66CDAA
rgb(102,205,170)
Lime
#00FF00
rgb(0,255,0)
LimeGreen
#32CD32
rgb(50,205,50)
SpringGreen
#00FF7F
rgb(0,255,127)
MediumSpringGreen
#00FA9A
rgb(0,250,154)
MediumSeaGreen
#3CB371
rgb(60,179,113)
SeaGreen
#2E8B57
rgb(46,139,87)
ForestGreen
#228B22
rgb(34,139,34)
Green
#008000
rgb(0,128,0)
DarkGreen
#006400
rgb(0,100,0)
FloralWhite
#FFFAF0
rgb(255,250,240)
SeaShell
#FFF5EE
rgb(255,245,238)
OldLace
#FDF5E6
rgb(253,245,230)
Linen
#FAF0E6
rgb(250,240,230)
PapayaWhip
#FFEFD5
rgb(255,239,213)
AntiqueWhite
#FAEBD7
rgb(250,235,215)
BlanchedAlmond
#FFEBCD
rgb(255,235,205)
Bisque
#FFE4C4
rgb(255,228,196)
PeachPuff
#FFDAB9
rgb(255,218,185)
Moccasin
#FFE4B5
rgb(255,228,181)
NavajoWhite
#FFDEAD
rgb(255,222,173)
Wheat
#F5DEB3
rgb(245,222,179)
BurlyWood
#DEB887
rgb(222,184,135)
Tan
#D2B48C
rgb(210,180,140)
SandyBrown
#F4A460
rgb(244,164,96)
Peru
#CD853F
rgb(205,133,63)
GhostWhite
#F8F8FF
rgb(248,248,255)
Lavender
#E6E6FA
rgb(230,230,250)
Thistle
#D8BFD8
rgb(216,191,216)
Plum
#DDA0DD
rgb(221,160,221)
Violet
#EE82EE
rgb(238,130,238)
HotPink
#FF69B4
rgb(255,105,180)
MediumSlateBlue
#7B68EE
rgb(123,104,238)
MediumPurple
#9370DB
rgb(147,112,219)
Orchid
#DA70D6
rgb(218,112,214)
MediumOrchid
#BA55D3
rgb(186,85,211)
SlateBlue
#6A5ACD
rgb(106,90,205)
DeepPink
#FF1493
rgb(255,20,147)
BlueViolet
#8A2BE2
rgb(138,43,226)
Blue
#0000FF
rgb(0,0,255)
Fuchsia
#FF00FF
rgb(255,0,255)
Magenta
#FF00FF
rgb(255,0,255)
DarkOrchid
#9932CC
rgb(153,50,204)
MediumVioletRed
#C71585
rgb(199,21,133)
DarkViolet
#9400D3
rgb(148,0,211)
MediumBlue
#0000CD
rgb(0,0,205)
RebeccaPurple
#663399
rgb(102,51,153)
DarkSlateBlue
#483D8B
rgb(72,61,139)
DarkBlue
#00008B
rgb(0,0,139)
DarkMagenta
#8B008B
rgb(139,0,139)
MidnightBlue
#191970
rgb(25,25,112)
Indigo
#4B0082
rgb(75,0,130)
Navy
#000080
rgb(0,0,128)
Purple
#800080
rgb(128,0,128)
White
#FFFFFF
rgb(255,255,255)
WhiteSmoke
#F5F5F5
rgb(245,245,245)
Gainsboro
#DCDCDC
rgb(220,220,220)
LightGray
#D3D3D3
rgb(211,211,211)
Silver
#C0C0C0
rgb(192,192,192)
DarkGray
#A9A9A9
rgb(169,169,169)
Gray
#808080
rgb(128,128,128)
DimGray
#696969
rgb(105,105,105)

Web Resources on HTML Colors

1. University of New Mexico: Colors in HTML
2. Colorado State University: HTML Color
3. Swarthmore College: Color Tutorial
4. University of Hawaii System: Hexadecimal Color Codes
5. MDN Web Docs: CSS color Property
6. MDN Glossary: HTML Color Codes

Questions and Answers related to HTML Colors

+ What are HTML color codes, and how can I use a hex color code like 0000ff in my web design? >

HTML color codes define colors using hexadecimal values. For example, #0000FF represents blue. You can use it in CSS like this: color: #0000FF; for text or background-color: #0000FF; for backgrounds.

+ How do I apply a gold hex code or gold hex colors to style elements in HTML? >

To apply gold color in HTML, use the hex code #FFD700. Example: color: #FFD700; for text or background-color: #FFD700; for background elements.

+ What is a hash color code, and how does it differ from hex colors code or hexadecimal rgb in HTML? >

A hash color code (e.g., #FF5733) is the same as a hex code, using a combination of six hexadecimal digits. RGB format, like rgb(255,87,51), represents the same color but uses decimal values.

+ How can I use an HTML color picker to select specific colors like ffb6c1 or 6b8e23 for font color HTML? >

Online tools like color pickers allow users to select and generate hex codes like #FFB6C1 (light pink) or #6B8E23 (olive green) for use in CSS.

+ What is the process for converting CMYK color to RGB for use as HTML css colors? >

CMYK (used for print) must be converted to RGB for HTML use. Online tools or software like Photoshop can help convert CMYK values to RGB, which can then be used as hex or rgb() values in CSS.

+ How do I incorporate a blue rgb code in my HTML design, and what is its significance compared to other color formats? >

To use a blue RGB color, define it as rgb(0, 0, 255). RGB provides flexibility over hex since it allows opacity adjustments using RGBA.

+ What are the differences between using an HTML text color code and an HTML background color code list in web styling? >

Text color is set using color, while background color is set using background-color. Example: color: #333; vs. background-color: #FFF;.

+ How can I convert a hex color to Pantone using a hex to pantone tool for consistent branding? >

Online tools like Pantone converters let users input a hex code (e.g., #FF5733) and get the closest Pantone match for branding consistency.

+ How do I use a color palette and hex color picker together to select both HTML colors and HTML css colors for my website? >

Use an online color palette tool like Coolors or Adobe Color to generate a cohesive color scheme, then use a hex color picker to apply specific colors in HTML/CSS.

You can Edit the codes Here

HTML a programming Language MATLAB a programming Language PHP a programming Language C++ a programming Language