Skip to content

Commit 9b62e3f

Browse files
committed
[css-forms] Commit initial idea document.
1 parent 5530d32 commit 9b62e3f

File tree

5 files changed

+150
-0
lines changed

5 files changed

+150
-0
lines changed

css-forms/Overview.bs

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<pre class='metadata'>
2+
Title: CSS Form Styling Module Level 1
3+
Shortname: css-forms
4+
Level: 1
5+
Status: DREAM
6+
ED: http://dev.w3.org/csswg/css-forms/
7+
No Editor: true
8+
Abstract: This document is currently a loosely-structured set of ideas and inspiration for CSS form styling.
9+
It is not an implementable standard. Do not look at this as anything but a collection of ideas.
10+
Warning: not ready
11+
</pre>
12+
13+
Basic Styling Proposals {#ideas}
14+
================================
15+
16+
This section sketches a few proposals for solving the form styling problem.
17+
18+
Prototypes {#prototypes}
19+
------------------------
20+
21+
This idea, originally suggested by fantasai,
22+
is that we can style a handful of "prototype" elements.
23+
Browser UI designers can then take the styling of those elements
24+
and extrapolate the design into their own UIs.
25+
At minimum, things like text, backgrounds, and borders can be used.
26+
At the limit, things like internal padding, border-radius, etc might be used.
27+
28+
<pre class='lang-css'>
29+
@control button {
30+
&lt;declaration-list>
31+
}
32+
33+
@control input {
34+
&lt;declaration-list>
35+
}
36+
37+
input::selection {
38+
&lt;declaration-list>
39+
}
40+
41+
...
42+
</pre>
43+
44+
<blockquote cite="https://lists.w3.org/Archives/Public/www-style/2015Jan/0490.html">
45+
You would be able to use styles for:
46+
47+
* font selection (css-fonts)
48+
* text decoration (css-text-decor)
49+
* text layout (css-text)
50+
* backgrounds & drop-shadow (css-backgrounds)
51+
* borders & padding (css-backgrounds)
52+
* filters
53+
* anything else we or a UA decides seems relevant
54+
55+
Most form controls, even a calendar widget or clock, are a combination of
56+
these three primitives in some way. If the UA is given the styling for
57+
these three primitives, and perhaps one or two more it can figure out how
58+
to style the rest.
59+
60+
For example, a calendar widget might have the month, the year, some buttons
61+
to move them around, the ability to click into them and edit them directly,
62+
and a representation of the days of the month. The selected day is selected.
63+
Perhaps the buttons only show up on :hover or :focus -- the UA decides. But
64+
it knows that a button should be this particular shade of blue with that
65+
particular border-radius and drop-shadow. The calendar might be shown in the
66+
colors of the input field, and the selected day in the selection color, and
67+
in all ways it will match the way the input fields look in the rest of the
68+
page.
69+
70+
Now, the author can't decide, for example, the spacing between the year
71+
and the month name, or whether the button to change years has a solid
72+
arrow or a hollow arrow or a frilly one, and she can't decide that there
73+
should be a black solid half-border between the month and the day field
74+
below it with 5px spacing. But the calendar will look like it belongs to
75+
the page, and the UA can come up with a different calendar layout when it
76+
ships one on a wide but short smart watch where the month and year are
77+
better placed on the side without breaking anything.
78+
</blockquote>
79+
80+
<div class='example'>
81+
<img src=images/time01.png>
82+
83+
<blockquote cite="https://lists.w3.org/Archives/Public/www-style/2015Jan/0622.html">
84+
The black area is the button color; a very light transparency of it
85+
can be the glass color. The rollers are the input colors.
86+
</blockquote>
87+
</div>
88+
89+
<div class='example'>
90+
<img src=images/time02.png>
91+
92+
<blockquote cite="https://lists.w3.org/Archives/Public/www-style/2015Jan/0622.html">
93+
It's hard to tell without more context, but for the one on the right,
94+
the clock face and the digital readout are @input colors, the highlighted
95+
bits are the highlight color, the Done button is the button styling,
96+
and the shaded area around the clock face is the same color as the
97+
button background.
98+
</div>
99+
100+
101+
Inverse System Colors {#inverse-system}
102+
---------------------------------------
103+
104+
This idea, originally sketched by Florian and Tab,
105+
is to define an abstract set of colors
106+
that UI designers can then choose from when coloring their UI.
107+
108+
Tab's suggested set of colors, from an Android color-extraction API proposal:
109+
110+
* Light/Normal/Dark Vibrant
111+
* Light/Normal/Dark Muted
112+
* Vibrant Complementary (for call-out buttons and such that need to be visually distinct)
113+
114+
(where light ~75% lightness, normal is ~50%, dark is ~25%; vibrant is
115+
at least 30% saturation, ideally 100%, and muted is at most 40%
116+
saturation, ideally 30%)
117+
118+
* Light/Dark Contrasting Text
119+
* Light/Dark Contrasting Secondary Text
120+
121+
That's 11 colors, many of which should be drawable from the webpage's own color scheme.
122+
We can auto-gen a bunch of them if you specify at least some of them,
123+
like genning the light/dark variants from the "normal-vibrant" color,
124+
or automatically setting text colors to white/black as appropriate.
125+
126+
There's no guarantee that the input UIs will use the colors in the *same way* that the rest of the page does, though.
127+
128+
129+
Input UI Examples {#examples}
130+
=============================
131+
132+
This section catalogues as many input UI examples as we can screenshot,
133+
especially on mobile devices where they're a bit "weirder".
134+
135+
Time Pickers {#time-examples}
136+
-----------------------------
137+
<figure>
138+
<img src="images/time01.png">
139+
<figcaption>iOS time picker</figcaption>
140+
</figure>
141+
142+
<figure>
143+
<img src="images/time02.png">
144+
<figcaption>Android time picker 1</figcaption>
145+
</figure>
146+
147+
<figure>
148+
<img src="images/time03.png">
149+
<figcaption>Android time picker 2</figcaption>
150+
</figure>

css-forms/images/datetime01.png

59.6 KB
Loading

css-forms/images/time01.png

69.7 KB
Loading

css-forms/images/time02.png

35.1 KB
Loading

css-forms/images/time03.png

23.8 KB
Loading

0 commit comments

Comments
 (0)