Skip to content

Commit 0ef4efe

Browse files
committed
[css-color-4] syntax hilighting
1 parent 98260f1 commit 0ef4efe

File tree

1 file changed

+49
-36
lines changed

1 file changed

+49
-36
lines changed

css-color-4/Overview.bs

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Value Definitions</h3>
140140

141141
<p>This same color could be expressed in various colorspaces:</p>
142142

143-
<pre>
143+
<pre class="lang-css">
144144
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(sRGB 0.41587 0.503670 0.36664);
145145
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(display-p3 0.43313 0.50108 0.37950);
146146
<span class="swatch" style="--color: rgb(41.587%, 50.3670%, 36.664%)"></span> color(a98-rgb 0.44091 0.49971 0.37408);
@@ -1246,7 +1246,7 @@ HSL Colors: ''hsl()'' and ''hsla()'' functions</h2>
12461246
For example, the following colors can all be generated off of the basic "green" hue,
12471247
just by varying the other two arguments:
12481248

1249-
<pre>
1249+
<pre class="lang-css">
12501250
hsl(120deg 100% 50%) <span style="color:black; background:hsl(120,100%,50%);">lime green</span>
12511251
hsl(120deg 100% 25%) <span style="color:white; background:hsl(120,100%,25%);">dark green</span>
12521252
hsl(120deg 100% 75%) <span style="color:black; background:hsl(120,100%,75%);">light green</span>
@@ -2135,7 +2135,7 @@ Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
21352135

21362136

21372137
<div class="example">
2138-
<pre>
2138+
<pre class="lang-css">
21392139
<span class="swatch" style="--color: rgb(49.06% 13.87% 15.9%)"></span> lab(29.2345% 39.3825 20.0664);
21402140
<span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lab(52.2345% 40.1645 59.9971);
21412141
<span class="swatch" style="--color: rgb(61.65% 57.51% 9.28%)"></span> lab(60.2345, -5.3654 58.956);
@@ -2174,7 +2174,7 @@ Specifying Lab and LCH: the ''lab()'' and ''lch()'' functional notations</h3>
21742174
and interpreted identically to the <<alpha-value>> in ''rgb()''.
21752175

21762176
<div class="example">
2177-
<pre>
2177+
<pre class="lang-css">
21782178
<span class="swatch" style="--color: rgb(49.06% 13.87% 15.9%)"></span> lch(29.2345% 44.2 27);
21792179
<span class="swatch" style="--color: rgb(77.61% 36.34% 2.45%)"></span> lch(52.2345% 72.2 56.2);
21802180
<span class="swatch" style="--color: rgb(61.65% 57.51% 9.28%)"></span> lch(60.2345% 59.2 95.2);
@@ -2275,7 +2275,7 @@ Profiled, Device-dependent Colors</h2>
22752275
are in the range 0.0 to 1.0
22762276
(rather than, for example, 0 to 255).
22772277
<!-- add examples with alpha, and with fallback -->
2278-
<pre>
2278+
<pre class="lang-css">
22792279
color: color(--swopc 0.0134 0.8078 0.7451 0.3019);
22802280
color: color(--indigo 0.0941 0.6274 0.3372 0.1647 0 0.0706 0.1216);
22812281
color: color(prophoto-rgb 0.9137 0.5882 0.4784);
@@ -2288,7 +2288,7 @@ Profiled, Device-dependent Colors</h2>
22882288
somewhere in the stylesheet,
22892289
to connect the name with the profile data.
22902290

2291-
<pre>
2291+
<pre class="lang-css">
22922292
@color-profile --swopc {
22932293
src: url('http://example.org/swop-coated.icc');}
22942294
@color-profile --indigo {
@@ -2312,6 +2312,26 @@ Profiled, Device-dependent Colors</h2>
23122312
and later colors acting as "fallback" if an earlier color [=can't be displayed=]
23132313
(for example, if the colorspace it specifies hasn't been loaded yet).
23142314

2315+
Each argument represents either an <dfn export>invalid color</dfn>, as described below,
2316+
or a [=valid color=].
2317+
2318+
A color may be a [=valid color=]
2319+
but still be outside the range of colors
2320+
that can be produced by an output device
2321+
(a screen, projector, or printer).
2322+
It is said to be <dfn export>out of gamut</dfn>
2323+
for that colorspace.
2324+
2325+
An out of gamut color has component values
2326+
less than 0 or 0%, or greater than 1 or 100%.
2327+
These are are not invalid; instead, they are
2328+
<a>gamut-mapped</a> using a relative colorimetric intent
2329+
which brings the values within the range 0/0% to 1/100%
2330+
at computed-value time.
2331+
2332+
Each [=valid color=] is either in-gamut for the output decice (screen, or printer),
2333+
or it is [=out of gamut=].
2334+
23152335
Each argument has the following form:
23162336

23172337
* An optional <<ident>> or <<dashed-ident>> denoting the colorspace.
@@ -2341,12 +2361,14 @@ Profiled, Device-dependent Colors</h2>
23412361
<dd>
23422362
If more <<number>>s or <<percentage>>s are provided than parameters that the colorspace takes,
23432363
the excess <<number>>s at the end are ignored.
2364+
The color is still a [=valid color=].
23442365

23452366
If fewer <<number>>s or <<percentage>>s are provided than parameters that the colorspace takes,
23462367
the missing parameters default to ''0''.
23472368
(This is particularly convenient for multichannel printers
23482369
where the additional inks are spot colors or varnishes
23492370
that most colors on the page won't use.)
2371+
The color is still a [=valid color=].
23502372

23512373
If a <<string>> is provided,
23522374
this argument represents an <a>invalid color</a>.
@@ -2367,38 +2389,29 @@ Profiled, Device-dependent Colors</h2>
23672389
using any CSS color syntax
23682390
can be provided.
23692391

2392+
This final argument can again be either a [=valid color=]
2393+
or an [=invalid color=]; and if valid it can be either
2394+
in-gamut for the output device, or [=out of gamut=].
2395+
2396+
A color which is either an [=invalid color=] or
2397+
an [=out of gamut=] color
2398+
<dfn export>can't be displayed</dfn>.
23702399

23712400
The ''color()'' function represents the color
2372-
specified by the first of its arguments that represent a <dfn export>valid color</dfn>
2373-
(that is, the first argument that isn't an <dfn export>invalid color</dfn>).
2374-
If all of its arguments represent <a>invalid colors</a>,
2401+
specified by the first of its arguments that <dfn export>can be displayed</dfn>,
2402+
(that is, the first argument that isn't an [=invalid color=]
2403+
and isn't [=out of gamut=]).
2404+
If all of its arguments [=can't be displayed=]],
23752405
''color()'' represents <a>opaque black</a>.
23762406

2377-
A color may be a [=valid color=]
2378-
but still be outside the range of colors
2379-
that can be produced by an output device
2380-
(a screen, projector, or printer).
2381-
It is said to be <dfn export>out of gamut</dfn>
2382-
for that colorspace.
2383-
2384-
An out of gamut color has component values
2385-
less than 0 or 0%, or greater than 1 or 100%.
2386-
These are are not invalid; instead, they are
2387-
<a>gamut-mapped</a> using a relative colorimetric intent
2388-
which brings the values within the range 0/0% to 1/100%
2389-
at computed-value time.
2390-
2391-
A color which is either an [=invalid color=] or
2392-
an [=out-of-gamut=] color
2393-
<dfn export>can't be displayed</dfn>.
23942407

23952408
<div class="example">
23962409
This very intense lime color is in-gamut for rec.2020:
2397-
<pre>color(rec2020 0.42053 0.979780 0.00579);</pre>
2410+
<pre class="lang-css">color(rec2020 0.42053 0.979780 0.00579);</pre>
23982411
in LCH, that color is
2399-
<pre>lch(86.6146 160.0000, 136.0088);</pre>
2412+
<pre class="lang-css">lch(86.6146 160.0000, 136.0088);</pre>
24002413
in display-p3, that color is
2401-
<pre>color(display-p3 -0.6112 1.0079 -0.2192);</pre>
2414+
<pre class="lang-css">color(display-p3 -0.6112 1.0079 -0.2192);</pre>
24022415
and is out of gamut for display-p3
24032416
(red and blue are negative, green is greater than 1).
24042417
If you have a display-p3 screen, that color is:
@@ -2414,7 +2427,7 @@ Profiled, Device-dependent Colors</h2>
24142427

24152428
<div class="example">
24162429
The same color as the previous example is now specified with a fallback
2417-
<pre>color(rec2020 0.42053 0.979780 0.00579, color(display-p3(0 1 0)));</pre>
2430+
<pre class="lang-css">color(rec2020 0.42053 0.979780 0.00579, color(display-p3(0 1 0)));</pre>
24182431
On a display-p3 screen,
24192432
because the first-choice color can't be displayed
24202433
and because a fallback has been given which is in-gamut for the display,
@@ -2653,7 +2666,7 @@ Predefined colorspaces: ''srgb'', ''display-p3'', ''a98-rgb'', ''prophoto-rgb'',
26532666
<div class="example">
26542667
These are exactly equivalent:
26552668

2656-
<pre>
2669+
<pre class="lang-css">
26572670
<span class="swatch" style="--color: #7654CD"></span> #7654CD;
26582671
<span class="swatch" style="--color: #7654CD"></span> rgb(46.27% 32.94% 80.39%)
26592672
<span class="swatch" style="--color: #7654CD"></span> color(lab 44.36 36.05 -58.99)
@@ -2669,7 +2682,7 @@ Predefined colorspaces: ''srgb'', ''display-p3'', ''a98-rgb'', ''prophoto-rgb'',
26692682
<div class="example">
26702683
These are exactly equivalent:
26712684

2672-
<pre>
2685+
<pre class="lang-css">
26732686
<span class="swatch" style="--color: rgb(38.29% 67.27% 93.85%)"></span> lab(67.5345% -8.6911 -41.6019);
26742687
<span class="swatch" style="--color: rgb(38.29% 67.27% 93.85%)"></span> color(lab 67.5345% -8.6911 -41.6019);
26752688
</pre>
@@ -2867,7 +2880,7 @@ you will use.
28672880

28682881
-->
28692882

2870-
<pre>
2883+
<pre class="lang-css">
28712884
@color-profile --fogra39 {
28722885
src: url('https://example.org/Coated_Fogra39L_VIGC_300.icc');
28732886
}
@@ -2925,7 +2938,7 @@ can proceed as normal.
29252938

29262939
-->
29272940

2928-
<pre>
2941+
<pre class="lang-css">
29292942
@color-profile --swop5c {
29302943
src: url('https://example.org/SWOP2006_Coated5v2.icc');
29312944
}
@@ -2961,7 +2974,7 @@ to be outside the sRGB gamut.
29612974

29622975
-->
29632976

2964-
<pre>
2977+
<pre class="lang-css">
29652978
@media (color-gamut: srgb) {
29662979
.header {
29672980
background-color: color(--fogra39 90% 0% 90% 0%, <span class="swatch" style="--color: rgb(8.154% 60.9704% 37.184%)"></span> rgb(8.154% 60.9704% 37.184%));
@@ -3041,7 +3054,7 @@ Colors are not restricted to four inks (CMYK). For example, wide-gamut 7 Color i
30413054

30423055
<!-- see file Macbeth-7color.txt --->
30433056

3044-
<pre>
3057+
<pre class="lang-css">
30453058
@color-profile --fogra55beta {
30463059
src: url('https://example.org/2020_13.003_FOGRA55beta_CL_Profile.icc');
30473060
}

0 commit comments

Comments
 (0)