@@ -1084,7 +1084,7 @@ the allowed [=channel keywords=] are:
1084
1084
<div class="example">
1085
1085
To manipulate color channels in the sRGB color space:
1086
1086
1087
- <pre>
1087
+ <pre highlight=css >
1088
1088
rgb(from <span class="swatch" style="--color: indianred"></span> indianred 255 g b)
1089
1089
</pre>
1090
1090
@@ -1099,15 +1099,15 @@ Relative sRGB color syntax is <em>only</em> applicable to the non-legacy RGB syn
1099
1099
For example, this attempt to use the rgba
1100
1100
<a>legacy color syntax</a> with commas would be incorrect
1101
1101
1102
- <pre>
1102
+ <pre highlight=css >
1103
1103
rgba(from <span class="swatch" style="--color: darkblue"></span> darkblue 16, 32, b, 0.5 )
1104
1104
</pre>
1105
1105
</div>
1106
1106
1107
1107
<div class="example">
1108
1108
Instead, use
1109
1109
1110
- <pre>
1110
+ <pre highlight=css >
1111
1111
rgb(from <span class="swatch" style="--color: darkblue"></span> darkblue 16 32 b / 0.5 )
1112
1112
</pre>
1113
1113
@@ -1152,7 +1152,7 @@ the allowed [=channel keywords=] are:
1152
1152
1153
1153
<div class="example">
1154
1154
This adds 180 degrees to the hue angle, giving a complementary color.
1155
- <pre>
1155
+ <pre highlight=css >
1156
1156
--accent: <span class="swatch" style="--color: lightseagreen"></span> lightseagreen;
1157
1157
--complement: <span class="swatch" style="--color: hsl(357deg 70% 41%)"></span> hsl(from var(--accent) calc(h + 180) s l);
1158
1158
</pre>
@@ -1232,7 +1232,7 @@ the allowed [=channel keywords=] are:
1232
1232
<div class="example">
1233
1233
Fully desaturating a color to gray, keeping the exact same lightness:
1234
1234
1235
- <pre>
1235
+ <pre highlight=css >
1236
1236
--mycolor: <span class="swatch" style="--color: orchid"></span> orchid;
1237
1237
// orchid is lab(62.753 52.460 -34.103)
1238
1238
--mygray: <span class="swatch" style="--color: rgb(59.515% 59.515% 59.515%)"></span> lab(from var(--mycolor) l 0 0)
@@ -1306,7 +1306,7 @@ the allowed [=channel keywords=] are:
1306
1306
1307
1307
<div class="example">
1308
1308
This adds 180 degrees to the hue angle, giving the complementary color.
1309
- <pre>
1309
+ <pre highlight=css >
1310
1310
--accent: <span class="swatch" style="--color: lightseagreen"></span> lightseagreen;
1311
1311
--complement: <span class="swatch" style="--color: rgb(88.2814% 51.1047% 58.3039%)"></span> lch(from var(--accent) l c calc(h + 180));
1312
1312
</pre>
@@ -1316,7 +1316,7 @@ the allowed [=channel keywords=] are:
1316
1316
<div class="example">
1317
1317
Fully desaturating a color to gray, keeping the exact same lightness:
1318
1318
1319
- <pre>
1319
+ <pre highlight=css >
1320
1320
--mycolor: <span class="swatch" style="--color: orchid"></span> orchid;
1321
1321
// orchid is lch(62.753 62.571 326.973)
1322
1322
--mygray: <span class="swatch" style="--color: rgb(59.515% 59.515% 59.515%)"></span> lch(from var(--mycolor) l 0 h)
@@ -1325,7 +1325,7 @@ the allowed [=channel keywords=] are:
1325
1325
1326
1326
But now (since the hue was preserved) <em> re-saturating</em> again
1327
1327
1328
- <pre>
1328
+ <pre highlight=css >
1329
1329
--mymuted: <span class="swatch" style="--color: rgb(72.710% 53.293% 71.224%)"></span> lch(from var(--mygray) l 30 h);
1330
1330
// mymuted is lch(62.753 30 326.973) which is rgb(72.710% 53.293% 71.224%)
1331
1331
</pre>
@@ -1345,7 +1345,7 @@ However, unlike HSL, manipulations are not guaranteed to be in-gamut.
1345
1345
1346
1346
-->
1347
1347
1348
- <pre>
1348
+ <pre highlight=css >
1349
1349
--mycolor: <span class="swatch" style="--color: rgb(86.1% 33.4% 97.6%)"></span> lch(60% 90 320);
1350
1350
lch(from var(--mycolor) l c calc(h - 120));
1351
1351
</pre>
@@ -1386,7 +1386,7 @@ However, unlike HSL, manipulations are not guaranteed to be in-gamut.
1386
1386
Performing the same operation in HSL will return an in-gamut result.
1387
1387
But it is unsatisfactory in other ways:
1388
1388
1389
- <pre>
1389
+ <pre highlight=css >
1390
1390
--mycolor: <span class="swatch" style="--color: rgb(86.1% 33.4% 97.6%)"></span> lch(60% 90 320);
1391
1391
hsl(from var(--mycolor) calc(h - 120) s l);
1392
1392
</pre>
@@ -1447,7 +1447,7 @@ The origin color is inside the RGB gamut,
1447
1447
but rotating the hue in Oklch
1448
1448
again produces an out of gamut color.
1449
1449
1450
- <pre>
1450
+ <pre highlight=css >
1451
1451
--mycolor: <span class="swatch" style="--color: rgb(86.1% 33.4% 97.6%)"></span> lch(60% 90 320);
1452
1452
oklch(from var(--mycolor) l c calc(h - 120));
1453
1453
</pre>
0 commit comments