Skip to content

Commit 35ece7e

Browse files
committed
[css-color-hdr] add swatches
1 parent 1ba7fd6 commit 35ece7e

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

css-color-hdr/Overview.bs

+6-5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Abstract: This module explores additions to CSS Color 4 to enable High Dynamic R
5858
}
5959
}
6060
</pre>
61+
<link rel="stylesheet" href="style.css" />
6162

6263
Introduction {#intro}
6364
=====================
@@ -149,7 +150,7 @@ Predefined colorspaces for HDR: {#predefined-HDR}
149150
Content is typically mastered with a lower peak white,
150151
such as 4,000 cd/m².
151152
<pre>
152-
color(rec2100-pq 1.0 1.0 1.0);
153+
<span class="swatch oog" style="--color: white"></span> color(rec2100-pq 1.0 1.0 1.0);
153154
</pre>
154155
</div>
155156

@@ -161,13 +162,13 @@ Predefined colorspaces for HDR: {#predefined-HDR}
161162
on any sized area of the screen.
162163
Diffuse white is 140 cd/m².
163164
<pre>
164-
color(rec2100-pq 0.54 0.54 0.54);
165+
<span class="swatch" style="--color: white"></span> color(rec2100-pq 0.54 0.54 0.54);
165166
</pre>
166167
This color represents a mid grey,
167168
like a photographer's "18% reflectance grey" card,
168169
at 17 cd/m².
169170
<pre>
170-
color(rec2100-pq 0.34 0.34 0.34);
171+
<span class="swatch" style="--color: rgb(46.632% 46.632% 46.632%)"></span> color(rec2100-pq 0.34 0.34 0.34);
171172
</pre>
172173
</div>
173174

@@ -253,12 +254,12 @@ Predefined colorspaces for HDR: {#predefined-HDR}
253254
of 1,000 to 4,000 cd/m²,
254255
so diffuse white will be 203 to 581 cd/m².
255256
<pre>
256-
color(rec2100-hlg 0.75 0.75 0.75);
257+
<span class="swatch" style="--color: white"></span> color(rec2100-hlg 0.75 0.75 0.75);
257258
</pre>
258259
This color represents a mid grey,
259260
at 26 to 104 cd/m².
260261
<pre>
261-
color(rec2100-hlg 0.38 0.38 0.38);
262+
<span class="swatch" style="--color: rgb(46.632% 46.632% 46.632%)"></span> color(rec2100-hlg 0.38 0.38 0.38);
262263
</pre>
263264
</div>
264265

css-color-hdr/style.css

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
.oog {
14+
border: 3px dashed;
15+
color: #c00;
16+
padding: 0;
17+
width: 1.2em;
18+
height: 1.2em;
19+
background-color: #ccc;
20+
}
21+
22+
.oog::before {
23+
content: "Out of gamut";
24+
display: inline-block;
25+
text-transform: uppercase;
26+
text-align: center;
27+
font: bold .3em/1.2 sans-serif;
28+
}
29+
30+
.swatch:hover {
31+
transform: scale(3);
32+
border-radius: 2px;
33+
transition: .4s;
34+
}

0 commit comments

Comments
 (0)