Christian Heilman:
The input type colour supports the
list
attribute, which allows you to define a preset list of options. The colours need to be defined as hexadecimal colours. They can be defined as values or text inside theoption
tags, but the values take precedence.
Pictured at the top of this post is how Chromium-browsers render the following snippet:
<input type="color" list="presets"></label>
<datalist id="presets">
<option value="#cccccc">Grey</option>
<option value="#ffffff">White</option>
<option value="#6699cc">Blue</option>
</datalist>
In his article he continues with dynamically adjust the colors to choose from, based on the color palette of an uploaded image.
UPDATE 2020-04-27: Turns out it’s also possible to limit the options for datepickers and range sliders: datalist experiment. (via)
Limiting input type=”color” to a certain palette (from an image) →
how to remove ‘other…’ option?
You can try and find the matching pseudo via https://www.bram.us/2021/04/15/identify-and-extract-pseudo-element-selectors-from-built-in-html-elements-using-devtools/, but it’s not guaranteed that you’ll find one …
Did you find any solution for that?