HTML <input type=”color”>

The HTML <input type=”color”> element is used to define a color picker. The value should be a seven-character hexadecimal notation representing RGB values in hexadecimal format. Its default value is #000000 (black).

Syntax

<input type="color"> 

Example: In this example, we will demonstrate the use of <input type=”color”>.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML Input Type Color
    </title>
</head>

<body style="text-align:center;">
    <h2>HTML &lt;input type="color"&gt;</h2>

    <form action="#">
        <label for="color">Select Color:</label>
        <input type="color" value="#009900" id="color">
    </form>
</body>

</html>

Output

Supported Browsers

  • Google Chrome 20
  • Edge 14
  • Firefox 29
  • Opera 12
  • Apple Safari 12.1

Contact Us