8

I am coding a form that has an input type color. When you click that, you see a colorpicker, and the rgb values of the default color. I would like to know if there's a way to have HEX colors as default. As in this example. By default it looks as the left part of the image, and I would like it to be as in the right part of the image. I don't know if this is possible. Thank you :)

1
  • 1
    You may like to read e.g. [link]developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/color which explains amongst other things that it's up to each browser how they show the color picker - it isn't a standard. You will have to implement your own 'frontend' to the input (or find someone else's code that has already done it) if you want your interface to look the same, and default to hex, on at least the most common browsers.
    – A Haworth
    Commented May 24, 2021 at 21:30

2 Answers 2

9

The color picker is provided as is by the browser, same way dropdowns appear as the browser has defined.

While there is a way to change some of it's appearance, you can not go as deep as you want. Also let me note that what you are seeing is how chrome shows the color picker, other browsers show it quite differently, if you open it in Firefox or Safari it will be different. If you want to go deeper into that topic, I found this article which is quite in-depth.

If you however want a much more customized user experience you could search for javascript color picker libraries and find one that suits your needs best or even write a custom implementation for it.

0
4

Color Picker by Default cannot set the HEX as default. You can use this library for better, it has many type of Color Picker that matches your needs.

https://casesandberg.github.io/react-color/

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.