Skip to content

Commit 806dd84

Browse files
committed
add colorspace example, with swatches
1 parent 0037c0a commit 806dd84

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

css-color-4/Overview.bs

+20-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ spec:css-color-4; type:descriptor; for:@color-profile; text:src
2121
spec:css-color-4; type:dfn; text:colorspace
2222
spec:css-color-4; type:dfn; text:gamut
2323
</pre>
24+
<link rel="stylesheet" href="style.css" />
2425

2526
<style>
2627
table.named-color-table thead th { text-align:center; background:black; color:white; }
@@ -103,7 +104,7 @@ Value Definitions</h3>
103104
the green in the leaf, and the photo, and the print will look the same.
104105
</div>
105106

106-
A <dfn>colorspace</dfn> is an organization of colors
107+
A <dfn export>colorspace</dfn> is an organization of colors
107108
with respect to an underlying
108109
<abbr title="colorimetry is the measurement of human color perception">colorimetric</abbr>
109110
model,
@@ -113,7 +114,24 @@ Value Definitions</h3>
113114
or transformed from one colorspace to another,
114115
while looking the same.
115116

116-
<div class="example"></div>
117+
<div class="example"><p>A leaf is measured
118+
with a spectrophotometer
119+
and found to have the color
120+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> lch(51.2345% 21.2 130)
121+
which is
122+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> lab(51.2345% -13.6271 16.2401).</p>
123+
124+
<p>This same color could be expressed in various colorspaces:</p>
125+
126+
<pre>
127+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(sRGB 0.41587, 0.503670, 0.36664);
128+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(display-p3 0.43313, 0.50108, 0.37950);
129+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(a98-rgb 0.44091 0.49971 0.37408);
130+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(prophoto-rgb 0.36589 0.41717 0.31333);
131+
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(rec2020 0.42210 0.47580 0.35605);
132+
</pre>
133+
134+
</div>
117135

118136
When the measured physical characteristics
119137
(such as the chromaticities of the primary colors it uses,

css-color-4/style.css

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.swatch {
2+
position: relative;
3+
z-index: 1;
4+
display: inline-block;
5+
vertical-align: calc(-.1em - 3px);
6+
padding: .6em;
7+
background-color: var(--color);
8+
border: 3px solid white;
9+
border-radius: 3px;
10+
box-shadow: 1px 1px 1px rgba(0,0,0,.15)
11+
}
12+
13+
.swatch:hover {
14+
transform: scale(3);
15+
border-radius: 2px;
16+
transition: .4s;
17+
}

0 commit comments

Comments
 (0)