[whatwg] Please reconsider: Set restricted palette for input type=color

Markus Ernst derernst at gmx.ch
Tue Mar 8 01:51:47 PST 2011


Am 07.03.2011 18:27 schrieb Markus Ernst:
> Reading 4.10.7.1.15 on the "Color" state of the input element, I miss a
> possibility how to define a set of allowed colors. For other states of
> the input element there are such possibilities, such as setting min, max
> and step attributes for input type=date.
>
> As UAs are encouraged to provide a user interface, such as a color
> picker, there should be a way to define a limited set of colors to be
> included in the picker.
>
> Use case:
> A content management or blog system for a corporate website allows to
> set font and background colors. The designers define allowed color sets
> the way that the corporate design guidelines are respected, and that the
> text is always readable - e.g. three light color shades for backgrounds,
> and two corporate colors and black for text.
>
> Possible solution:
> Slightly strengthen the impact of the list attribute for this input
> type. If there is a suggestion source element with one or more valid
> colors, color pickers are required to only display the colors specified
> there.

Searching for implementations of input type=color, I found that Opera 
actually implemented the color picker quite similar to my suggestion. If 
there is a suggestion source element, Opera displays a color palette 
with the colors listed there, and an "Other..." button that leads to the 
detailled color picker.

I personnally would like a possibility to hide the "Other..." button, 
but this is not really a need. Opera's behaviour makes it possible to 
provide a consistent validation message, saying something like: "Please 
choose one of the suggested colors. Sorry, other colors are not allowed 
here."

Is it possible to spec Opera's behaviour as a standard for color picking 
UIs?


More information about the whatwg mailing list