can I make the HTML color input only display hex?

Viewed 3959

I don't really know if this makes any sense at all but I wanted to know if there is a way to make the color picker of a color input to just display the hex picker.

If you click on the input the following box is display with the option for rgb:

enter image description here

Instead of that I only want my users to pick HEX values and I was wondering if there is any way to achieve that.

I know that if you click on the arrows it will change, but for some technical issues I can only accept hex values and I was wondering if there is a way to achieve this because I think it would be more user friendly rather than putting a text asking for the user to click on the arrows until the ex picker appears.

Thanks!

2 Answers

You can't make it only display hex, but whatever mode the user chooses the value is stored as hex.

why you don't put a input with place holder of "enter your hex code"? and validate it. if that was a valid hex color then continue else show a error to user

Related