最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - can I make the HTML color input only display hex? - Stack Overflow

programmeradmin2浏览0评论

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:

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!

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:

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!

Share Improve this question asked Jul 20, 2020 at 19:30 F2BEARF2BEAR 1941 gold badge2 silver badges11 bronze badges 3
  • 1 Remarkably similar to stackoverflow./questions/62999588/… – j08691 Commented Jul 20, 2020 at 19:33
  • 1 @j08691 it would be nice if that question had any answer, which it doesn't – F2BEAR Commented Jul 20, 2020 at 19:35
  • @FacuCarbonel, Were you able to find any solution? – PiyaModi Commented Jun 10, 2021 at 23:33
Add a ment  | 

2 Answers 2

Reset to default 1

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

发布评论

评论列表(0)

  1. 暂无评论