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

Markus Ernst derernst at gmx.ch
Mon Mar 7 09:27:43 PST 2011


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.

Rationale:
While searching the list archives, I found a message from Ian Hickson:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2008-November/017482.html
He suggested to use a select element for the purpose of a restricted 
color set. Here's why I think it would be worth to reconsider this position:
- A select element would display color names or values instead of 
showing the colors, which does not make it a suitable UI for choosing 
colors.
- Restricting the color palette is actually almost as common a task, as 
defining start and end dates of a date picker, and for sure more common 
than defining a step in a date picker. Now we have the benefit of this 
specialized color input element, it is a pity if it lacks customization 
potential.
- The fact that most CMS do not have restricted color sets so far, does 
not mean there is no demand for it, but rather shows the difficulty of 
customizing tools such as TinyMCE. It is a hassle for CMS implementors 
(who are often not highly skilled JS programmers), if they are expected 
to respect corporate design guidelines.
- I assume that restricting a color set in an existing color picker is 
not too hard to implement (of course I have no evidence for this 
assumption).


More information about the whatwg mailing list