summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xcolor/xcolor.dtx
blob: 48ab957f481581a47aa4f65361749fe75bef5b27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
% \iffalse meta-comment
%%
%% ----------------------------------------------------------------
%% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de>
%% ----------------------------------------------------------------
%%
%<*package>
%% Please send error reports and suggestions for
%% improvements to the above email address.
%%
%% This package contains code copied from
%%
%% color.dtx [1999/02/16 v1.0i Standard LaTeX Color (DPC)]
%% Copyright (C) 1994--1999 David Carlisle
%%
%% which is part of the Standard LaTeX `Graphics Bundle'.
%%
%</package>
%<*extract|driver|test1|test2|test3|test4>
\def\XCfileversion{v2.12}%
\def\XCfiledate{2016/05/11}%
%</extract|driver|test1|test2|test3|test4>
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% \fi
%
% \CheckSum{4864}
%
% \DoNotIndex{\def,\gdef,\edef,\xdef,\long,\let}
% \DoNotIndex{\ifnum,\ifdim,\iftrue,\iffalse,\ifx,\ifcase,\else,\or,\fi}
% \DoNotIndex{\bgroup,\egroup,\begingroup,\endgroup,\begin,\end}
% \DoNotIndex{\relax,\endinput}
% \DoNotIndex{\csname,\endcsname,\string,\the,\noexpand,\expandafter}
% \DoNotIndex{\advance,\count,\dimen}
% \DoNotIndex{\m@ne,\z@,\@ne,\tw@,\p@,\@@tmp}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \iffalse
%<*batchfile>
\IfFileExists{xcolor.ins}{\let\uknext=\relax}{\let\uknext=\stop}
\begin{filecontents*}{xcolor.ins}
%% Package `xcolor' by Dr. Uwe Kern
%%
%% Extract all package files:
%%   `latex xcolor.ins'
%%
%% Put the generated files to their respective locations
%% within the TeX installation:
%%   *.sty -> /tex/latex/xcolor/
%%   *.def -> /tex/latex/xcolor/
%%   *.pro -> /dvips/xcolor/
%%
%% Create the documentation:
%%   `latex xcolor.dtx'
%%   `latex xcolor.dtx'
%%   `makeindex -s gind.ist xcolor.idx'
%%   `latex xcolor.dtx'
%%   `latex xcolor.dtx'
%%
%% Run the test files (N=1,2,...):
%%   `latex xcolorN.tex'
%%   `latex xcolorN.tex'
%%
\def\batchfile{xcolor.ins}
\input docstrip.tex
\askforoverwritefalse
\generate{\file{xcolor.lox}{\from{xcolor.dtx}{extract}}}
\batchinput{xcolor.lox}
\endbatchfile
\end{filecontents*}
%</batchfile>
%
%<*driver>
\listfiles
\ProvidesFile{xcolor.dtx}[\XCfiledate\space\XCfileversion\space
                          `xcolor' source and documentation (UK)]
\documentclass{ltxdoc}
\usepackage[table,showerrors,dvipsnames,hyperref]{xcolor}[2005/06/06]
\usepackage{chngpage,varioref,tabularx,amsmath,amsthm}
\usepackage
 [\GinDriver,hyperindex=false,bookmarks,bookmarksopen,bookmarksopenlevel=1,%
  pdftitle={xcolor \XCfileversion{} (\XCfiledate)},pdfauthor={Dr. Uwe Kern},%
  pdfsubject={Color extensions for LaTeX and pdfLaTeX},%
  pdfkeywords={xcolor,color,colour,model,tint,tone,shade,harmony,spot,latex,pdftex,dvips,%
   conversion,blend,mix,mask,separation,rgb,cmy,cmyk,hsb,gray,html,wave,thsb,wheel}]{hyperref}
\OnlyDescription
\EnableCrossrefs
\CodelineIndex
\makeatletter
\def\Meaning#1{\texttt{\expandafter\expandafter\expandafter\strip@prefix\expandafter\meaning\csname #1\endcsname}}
\makeatother
\pagestyle{myheadings}
\markright{\hskip-2.5cm xcolor \XCfileversion\space(\XCfiledate)}
\begin{document}
 \DocInput{xcolor.dtx}
 \let\Section\section\def\section*#1{\Section*{#1}\addcontentsline{toc}{section}{#1}}
 \begin{adjustwidth}{-2.5cm}{}
 \def\markboth#1#2{}\PrintIndex
 \end{adjustwidth}
\end{document}
%</driver>
%
%<*extract>
\def\ukfile#1#2#3#4%
 {\def\ukhead
   {\ifnum#1>2 \perCent!^^J\fi
    \defaultpreamble^^J\MetaPrefix^^J%
    \ifcase#1
      \string\ProvidesPackage{#2}^^J\or
      \string\ProvidesFile{#2}^^J\or
      \string\ProvidesFile{#2.def}^^J\or
      \MetaPrefix\space #2.pro (PostScript/dvips header file)^^J\MetaPrefix\space
    \fi
    \space[\XCfiledate\space\XCfileversion\space#4\space(UK)]}
  \usepreamble\ukhead
  \file{#2.\ifcase#1sty\or tex\or def\or pro\fi}{\from{xcolor.dtx}{#3}}}
\generate{
\ukfile0{xcolor}{package}{LaTeX color extensions}
\ukfile2{svgnam}{svgnames}{Predefined colors according to SVG 1.1}
\ukfile2{x11nam}{x11names}{Predefined colors according to Unix/X11}
\ukfile1{xcolor1}{test1}{Color conversion test}
\ukfile1{xcolor2}{test2}{Pstricks color test}
\ukfile1{xcolor3}{test3}{Color logging test}
\ukfile1{xcolor4}{test4}{Color driver test}
\def\PStail{\MetaPrefix\space End of file `\outFileName'.}
\usepostamble\PStail
\ukfile3{xcolor}{dvips}{LaTeX color extensions}
}
%</extract>
% \fi
%
%
%
% \iffalse
%-------------------------------------------------------------------------------
% \fi
%
%
% \makeatletter
%
% \def\testclr#1#{\@testclr{#1}}
% \def\@testclr#1#2{{\fboxsep\z@\fbox{\colorbox#1{#2}{\phantom{XX}}}}}
% \def\Testclr#1#{\@Testclr{#1}}
% \def\@Testclr#1#2#3{\testclr#1{#2}~\rlap{\Color[-]{#3}}\\}
% \def\TestClr#1#{\@TestClr{#1}}
% \def\@TestClr#1#2#3{\testclr#1{#2}~\rlap{\Color[+]{#3}}\\}
% \newif\if@Meta
% \DeclareRobustCommand*\Meta{\@ifstar{\@Metatrue\@Meta}{\@Metafalse\@Meta}}
% \newcommand*\@Meta[2][]{\meta{#2}\@ifxempty{#1}{}{\ensuremath{\mskip-1mu\rule[-.4ex]{0pt}{1ex}_{#1}}}\if@Meta\index{arguments\levelchar\meta{#2}\string|usage}\fi}
% \def\DescribeArg#1{\leavevmode\@bsphack\marginpar{\raggedleft\Meta*{#1}}\@esphack\ignorespaces}
% \def\DescribeFunc#1{\leavevmode\@bsphack\marginpar{\raggedleft\Function{#1}\strut}\@esphack\ignorespaces}
%
% \makeatother
%
% \def\Index#1{#1\index{#1\string|usage}}
% \def\Package#1{\textsf{#1}\index{packages\levelchar\textsf{#1}\string|usage}}
% \def\Program#1{\textsf{\itshape#1}\index{programs\levelchar\textsf{\itshape#1}\string|usage}}
% \def\Model#1{\textsf{\bfseries#1}\index{color models\levelchar\textsf{\bfseries#1}\string|usage}}
% \def\nModel#1{`#1'\index{color models\levelchar`#1'\string|usage}}
% \def\pModel#1{\textbf{\itshape #1}}
% \def\People#1#2{#1 #2\index{people\levelchar#2, #1\string|usage}}
% \newcommand*\Color[2][+]{\textsl{#2}\ifx#1+\index{color names\levelchar\textsl{#2}\string|usage}\fi}
% \def\Option#1{\texttt{#1}\index{package options\levelchar\texttt{#1}\string|usage}}
% \def\oOption#1{\texttt{#1}\index{package options (obsolete)\levelchar\texttt{#1}\string|usage}}
% \def\Key#1{\textit{#1}\index{keys\levelchar\textit{#1}\string|usage}}
% \def\File#1{\texttt{#1}\index{files\levelchar\texttt{#1}\string|usage}}
% \def\Function#1{\textit{#1}\index{color functions\levelchar\textit{#1}\string|usage}}
% \def\Op#1#2{#1\nolimits_{\,\Model{#2}}}
% \def\med{\mathop{\textrm{med}}}
% \def\mix{\mathop{\textrm{mix}}}
% \def\rd{\mathop{\textrm{round}}}
% \def\tint{\mathop{\textrm{tint}}}
% \def\shade{\mathop{\textrm{shade}}}
% \def\tone{\mathop{\textrm{tone}}}
% \def\LC{\Package{color}}
% \def\LCP{\Package{color} package}
% \def\XC{\Package{xcolor}}
% \def\XCP{\Package{xcolor} package}
% \def\XCW{\texttt{\href{http://www.ukern.de/tex/xcolor.html}{www.ukern.de/tex/xcolor.html}}}
% \def\URL#1{\texttt{\url{#1}}}
% \def\CTAN#1#2{\texttt{\href{http://www.ctan.org/tex-archive/#1}{CTAN/#1#2}}}
% \newtheorem{lemma}{Lemma}
% \def\RtoI#1{\Gamma_{\!#1}}
% \def\ItoR#1{\Delta_{#1}}
% \def\bbbN{\textrm{I\kern-.333ex N}}
% \def\bbbR{\textrm{I\kern-.333ex R}}
% \def\Circ{\textsuperscript{$\circ$}}
%
% \newdimen\XCdim
%
% \parindent0pt
% \extrarowheight1pt
% \def\textfraction{0.01}
% \def\topfraction{0.99}
% \def\bottomfraction{0.99}
% \def\floatpagefraction{0.70}
% \setlength\abovecaptionskip{12pt}
% \setlength\belowcaptionskip{10pt}
% \colorlet{tableheadcolor}{gray!25}
% \colorlet{tablerowcolor}{gray!12.5}
%
%
%
% \title{Extending \LaTeX's color facilities: the \XCP}
% \author{\href{mailto:xcolor@ukern.de}{\fboxrule0pt\fboxsep2pt\fbox{Dr. Uwe Kern}}}
% \date{\XCfileversion{} (\XCfiledate)
%       \thanks{This package can be downloaded from \CTAN{macros/latex/contrib/xcolor/}{}.
%               There is also an \textsf{xcolor} homepage: \XCW.
%               Please send error reports and suggestions for improvements to the author:
%               \texttt{\href{mailto:xcolor@ukern.de}{xcolor@ukern.de}}.}}
% \maketitle
%
% \begin{abstract}
% \noindent
% \XC{} provides easy driver-independent access to several kinds of colors, tints, shades, tones, and mixes of arbitrary colors by means of color expressions like |\color{red!50!green!20!blue}|.
% It allows to select a document-wide target color model and offers tools for automatic color schemes, conversion between twelve color models, alternating table row colors, color blending and masking, color separation, and color wheel calculations.
% \end{abstract}
%
% \phantomsection\pdfbookmark[1]{\contentsname}{toc}
% \tableofcontents\listoftables\listoffigures\newpage
%
%
%
%
% \clearpage
% \section{Introduction}
%
% \subsection{Purpose of this package}
%
% The \LCP{} provides a powerful and stable tool for handling colors within (pdf)\LaTeX{} in a consistent and driver-independent way, supporting several color models (slightly less driver-independent).
%
% Nevertheless, it is sometimes a bit clumsy to use, especially in cases where slight color variations, color mixes or color conversions are involved:
% this usually implies the usage of another program that calculates the necessary parameters, which are then copied into a |\definecolor| command in \LaTeX.
% Quite often, also a pocket calculator is involved in the treatment of issues like the following:
% \begin{itemize}
% \item My company has defined a corporate color, and the printing office tells me how expensive it is to use more than two colors in our new brochure, whereas all kinds of tints (e.g., a 75\% version) of our color can be used at no extra cost.
% But how to access these color variations in \LaTeX?\\
% (Answer: |\color{CorporateColor!75}| etc.)
% \item My friend uses a nice color which I would like to apply in my own documents; unfortunately, it is defined in the \Model{hsb} model which is not supported in my favorite application pdf\LaTeX.
% What to do now?\\
% (Answer: just use the \Model{hsb} definitions, \XC{} will do the necessary calculations)
% \item How does a mixture of 40\% \Color{green} and 60\% \Color{yellow} look like?\\
% (Answer: 40\% \testclr{green} $+$ 60\% \testclr{yellow} $=$ \testclr{green!40!yellow}, e.g., |\color{green!40!yellow}|)
% \item And how does its complementary color look like?\\
% (Answer: \testclr{-green!40!yellow}, accessible via |\color{-green!40!yellow}|)
% \item Now I want to mix three parts of the last color with two parts of its complement and one part of \Color{red}.
% How does that look?\\
% (Answer: $3\times$ \testclr{-green!40!yellow} $+ 2\times$ \testclr{green!40!yellow} $+ 1\times$ \testclr{red} $=$ \testclr{rgb:-green!40!yellow,3;green!40!yellow,2;red,1}, the last color being accessible via |\color{rgb:-green!40!yellow,3;green!40!yellow,2;red,1}|)
% \item I know that light waves of 485nm are within the visible range. But which color do they represent?\\
% (Answer: approximately \testclr[wave]{485}, via |\color[wave]{485}|)
% \item My printing office wants all color definitions in my document to be transformed into the \Model{cmyk} model.
% How can I do the calculations efficiently?\\
% (Answer: |\usepackage[cmyk]{xcolor}| or |\selectcolormodel{cmyk}|)
% \item I have a table with 50 rows.
% How can I get alternating colors for entire rows without copying 50 |\rowcolor| commands? The alternating scheme should start in the 3rd row.\\
% (Answer: something like |\rowcolors{3}{OddColor}{EvenColor}|)
% \end{itemize}
% These are some of the issues solved by the \XCP.
% Its purpose can be summarized as to maintain the characteristics of \LC, while providing additional features and flexibility with (hopefully) easy-to-use interfaces.
%
%
%
% \subsection{Color tints, shades, tones, and complements}
%
% According to \cite{smith} we define the terms
% \begin{itemize}
% \item \textbf{\Index{tint}}: a color with \Color{white} added,
% \item \textbf{\Index{shade}}: a color with \Color{black} added,
% \item \textbf{\Index{tone}}: a color with \Color{gray} added.
% \end{itemize}
% These are special cases of a general function
% $\mix(C,C',p)$ which constructs a new color, consisting of $p$ parts of color $C$ and $1-p$ parts of color $C'$, where $0\le p\le1$.
% Thus, we set
% \begin{align}
% \tint(C,p) &:= \mix(C,|white|,p)\\
% \shade(C,p) &:= \mix(C,|black|,p)\\
% \tone(C,p) &:= \mix(C,|gray|,p)
% \end{align}
% where |white|, |black|, and |gray| are model-specific constants, see table \vref{tab.const}.
% Further we define the term
% \begin{itemize}
% \item \textbf{complement}: a color $C^*$ that yields \Color{white} if superposed with the original color $C$,
% \end{itemize}
% knowing that there are also different concepts of complementarity in place (e.g., opposite colors on \emph{color wheels}).
% See section \vref{sec.cnv} for calculation details and section \vref{sec.harmony} for some remarks on color wheels.
%
%
%
% \subsection{Color models}
%
% A color model is a tool to describe or represent a certain set of colors in a way that is suitable for the desired target device, e.g., a screen or a printer.
% There are proprietary models (like \Index{Pantone} or \Index{HKS}) that provide finite sets of colors (often called \emph{\Index{spot color}s}), where the user has to choose from without caring about parametrisations; on the other hand, there are parameter-driven models like \Model{gray}, \Model{rgb}, and \Model{cmyk}, that aim to represent large finite or even (theoretically) infinite sets of colors, built on very small subsets of base colors and rules, how to construct other colors from these base colors.
% For example, a large range of colors can be constructed by linear combinations of the base colors \Color{red}, \Color{green}, and \Color{blue}.
% On the other hand, usually \Index{spot color}s can only be \emph{approximated} by parameter values in models like \Model{cmyk} or \Model{rgb}; the original colors are being physically mixed even dependent on the targeted kind of paper.
% Finally, there are certain colors like \Color{gold} and \Color{silver} that are hardly reproducable by any parameter-driven color model on standard ink or laser printers.
%
%
%
% \subsection{Color wheels and color harmony}\label{sec.harmony}
%
% There has been a long history of placing colors (hues) on wheels in order to discuss theoretical or practical color issues (e.g., \People{Isaac}{Newton}, \People{Johann Wolfgang von}{Goethe}).
% One reason may be that the circle itself is a natural tool to demonstrate common relationships as well as opposite properties.
%
% Nowadays, there exists some confusion about notions, since both major areas related to color --- art and graphics design on one hand, scientific color theory on the other hand --- tend to use the same words to describe color properties, however meaning sometimes very different facts!
% Thus, the appearance of color wheels differs as well as the meaning of concepts like `primary' or `complementary' colors.
%
%
% \paragraph{Typical color wheel construction}
% First, three \emph{primary colors} are placed at 0\Circ, 120\Circ, 240\Circ (artists often choose \Color{red}, \Color{yellow}, \Color{blue}, whereas color scientists might prefer \Color{red}, \Color{green}, \Color{blue}).
% Next, three \emph{secondary colors} are put at 60\Circ, 180\Circ, 300\Circ.
% Then, six \emph{tertiary colors} may be placed in between (30\Circ, 90\Circ, \dots).
% This is why color wheels are frequently described to consist of twelve equidistant colors, although the algorithm can be repeated arbitrarily often.
%
%
% \paragraph{Color harmonies derived from a wheel}
% We start with an arbitrary color wheel:
% \begin{itemize}
% \item \textbf{complementary colors} have a distance of 180\Circ{} on the wheel,
% \item \textbf{color triads} consist of three colors in 120\Circ{} steps,
% \item \textbf{color tetrads} consist of four colors in 90\Circ{} steps.
% \end{itemize}
% We assume now that the wheel is partitioned into $2n$ sectors of equal size:
% \begin{itemize}
% \item \textbf{split complementary colors} of a given color are the two immediate neighbours of its complementary color, characterised by the positions $\frac{n\pm1}{2n}\cdot360^\circ$,
% \item \textbf{analogous colors} to a given color are its two or four neighbours, characterised by the positions $\pm\frac{1}{2n}\cdot360^\circ$ and $\pm\frac{2}{2n}\cdot360^\circ$.
% \end{itemize}
% Given these methods to generate `color harmonies', we conclude that the results depend heavily on how we constructed the wheel!
% Moreover, the choice of $n$ will affect the visual results as well.
% Examples are shown in figure \vref{fig.harmony}.
%
%
%
%
% \clearpage
% \section{The User Interface}
%
% \subsection{Preparation}
%
% \subsubsection{Package installation}
%
% First of all, put \File{xcolor.sty} and all the \File{.def} files to some place where (pdf)\LaTeX{} finds them.
% A typical place according to the \emph{\TeX\ Directory Structure} (TDS) would be the directory |texmf/tex/latex/xcolor|, where |texmf| denotes the main directory of your \TeX\ installation.
% Additionally, put \File{xcolor.pro} to a place where \Program{dvips} finds it, typically |texmf/dvips/xcolor|.
% Usually, you will have to run some kind of filename database update in order to make the files known and quickly searchable to the \TeX\ system.
% Then simply use \XC{} (instead of \LC) in your document.
% Thus, the general command is |\usepackage|\oarg{options}|{xcolor}| in the document preamble.
% Table \vref{tab.package} shows what has to be taken into account with respect to the package loading order.
%
%
% \subsubsection{Package options}
%
% In general, there are several types of options:
% \begin{itemize}
% \item options that determine the color driver as explained in \cite{dpc} and \cite{color}, currently: \Option{dvips}, \Option{xdvi}, \Option{dvipdf}, \Option{dvipdfm}, \Option{dvipdfmx}, \Option{luatex}, \Option{pdftex}, \Option{dvipsone}, \Option{dviwindo}, \Option{emtex}, \Option{dviwin}, \Option{oztex}, \Option{textures}, \Option{pctexps}, \Option{pctexwin}, \Option{pctexhp}, \Option{pctex32}, \Option{truetex}, \Option{tcidvi}, \Option{vtex}, \Option{xetex},
% \item options that determine the target color model\footnote{Section \vref{sec.tgt} explains how this setting can be overridden at any point in a document.} (\Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}) or disable colored output (\Option{monochrome}),
% \item options that control whether and how certain sets of predefined colors are being loaded: \Option{dvipsnames}, \Option{dvipsnames*}, \Option{svgnames}, \Option{svgnames*}, \Option{x11names}, \Option{x11names*},
% \item options that determine which other packages are to be loaded or supported: \Option{table}, \Option{fixpdftex},
% \Option{hyperref},
% \item options that influence the behaviour of other commands: \Option{prologue}, \Option{kernelfbox}, \Option{xcdraw}, \Option{noxcdraw}, \Option{fixinclude}, \Option{showerrors}, \Option{hideerrors},
% \item obsolete options:
% \oOption{pst},
% \oOption{override}, \oOption{usenames}, \oOption{nodvipsnames}.
% \end{itemize}
% All available package options (except driver selection and obsolete options) are listed in table \vref{tab.opt}.
% \DescribeMacro\GetGinDriver
% \DescribeMacro\GinDriver
% In order to facilitate the co-operation with the \Package{hyperref} package, there is a command |\GetGinDriver|\footnote{This command is executed automatically if the package option \Option{hyperref} is used.} that grabs the driver actually used and puts it into the command |\GinDriver|.
% The latter can then be used within \Package{hyperref} (or other packages), see the code example on page \pageref{ex.range}.
% If there is no corresponding \Package{hyperref} option, \Option{hypertex} will be taken as default.
%
% Warning: there is a substantial difference between \XC{} and \LC{} regarding how the \Option{dvips} option is being handled.
% The \LCP{} implicitly invokes the \Option{dvipsnames} option, whenever one of the |dvips|, |oztex|, |xdvi| drivers is selected.
% This makes documents less portable, since whenever one of these colors is used without explicit \Option{dvipsnames} option, other drivers like |pdftex| will issue error messages because of unknown colors.
% Therefore, \XC{} always requires an explicit \Option{dvipsnames} option to use these names --- which then works for all drivers.
%
%
% \begin{table}[p]\caption{Package options}\label{tab.opt}
% \extrarowheight2pt
% \begin{adjustwidth}{-2.5cm}{}
% \advance\textwidth2.5cm
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabularx}{\linewidth}{lX}
% \hline
% \rowcolor{tableheadcolor}
% \em Option & \em Description\\
% \Option{natural}& (Default.) Keep all colors in their model, except \Model{RGB} (converted to \Model{rgb}), \Model{HSB} (converted to \Model{hsb}), and \Model{Gray} (converted to \Model{gray}).\\
% \Option{rgb}& Convert all colors to the \Model{rgb} model.\\
% \Option{cmy}& Convert all colors to the \Model{cmy} model.\\
% \Option{cmyk}& Convert all colors to the \Model{cmyk} model.\\
% \Option{hsb}& Convert all colors to the \Model{hsb} model.\\
% \Option{gray}& Convert all colors to the \Model{gray} model. Especially useful to simulate how a black \& white printer will output the document.\\
% \Option{RGB}& Convert all colors to the \Model{RGB} model (and afterwards to \Model{rgb}).\\
% \Option{HTML}& Convert all colors to the \Model{HTML} model (and afterwards to \Model{rgb}).\\
% \Option{HSB}& Convert all colors to the \Model{HSB} model (and afterwards to \Model{hsb}).\\
% \Option{Gray}& Convert all colors to the \Model{Gray} model (and afterwards to \Model{gray}).\\
% \hline
% \Option{dvipsnames}, \Option{dvipsnames*}& Load a set of predefined colors.\footnotemark[1]\\
% \Option{svgnames}, \Option{svgnames*}& Load a set of predefined colors according to \Index{SVG} 1.1.\footnotemark[1]\\
% \Option{x11names}, \Option{x11names*}& Load a set of predefined colors according to \Index{Unix}/\Index{X11}.\footnotemark[1]\\
% \hline
% \Option{table}& Load the \Package{colortbl} package, in order to use the tools for coloring rows, columns, and cells within tables.\\
% \Option{fixpdftex}& Load the \Package{pdfcolmk} package, in order to improve |pdftex|'s color behaviour (see section \vref{sec.fixpdftex}).\\
% \Option{hyperref}& Support the \Package{hyperref} package in terms of color expressions by defining additional keys (see section \vref{sec.hyperref}).\\
% \hline
% \Option{prologue}& Write prologue information to \File{.xcp} file for every color definition (as described in section \vref{sec.prologue}).\\
% \hline
% \Option{kernelfbox}& Use \LaTeX{} kernel method to draw \texttt{\string\f(rame)box} frames\footnotemark[2].\\
% \Option{xcdraw}& Use driver-specific commands to draw frames and color boxes.\footnotemark[2]\\
% \Option{noxcdraw}& (Default.) Use generic code to draw frames and color boxes.\footnotemark[2]\\
% \Option{fixinclude}& Prevent |dvips| color reset before \File{.eps} file inclusion (see section \vref{sec.fixinclude}).\\
% \hline
% \Option{showerrors}& (Default.) Display an error message if an undefined color is being used (same behaviour as in the original \LCP).\\
% \Option{hideerrors}& Display only a warning if an undefined color is being used, and replace this color by \Color{black}.\\
% \hline\hline
% \multicolumn2{c}{\footnotemark[1]\,See section \vref{sec.additionalcolors}.\quad \footnotemark[2]\,See section \vref{sec.fbox}.}\\
% \hline
% \end{tabularx}
% \end{adjustwidth}
% \end{table}
%
%
% \begin{table}[htbp]\caption{Package loading order}\label{tab.package}
% \begin{adjustwidth}{-2.5cm}{}
% \raggedleft
% \extrarowheight2pt
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabular}{l*{6}{c}}
% \hline
% \rowcolor{tableheadcolor}
% \em Action/Package    & \Package{colortbl}& \Package{pdfcolmk}& \Package{hyperref}& \Package{pstricks}& \LC& \Package{pstcol}\\
% load before \XC       & no & no & allowed & allowed\rlap{\footnotemark[1]} & no & no  \\
% load with \XC{} option& \Option{table} & \Option{fixpdftex} & --- & --- & --- & --- \\
% load after \XC        & no & allowed & allowed & allowed & no & no \\
% \hline\hline
% \multicolumn6{c}{\footnotemark[1]\,recent \Package{pstricks} versions do load \XC\ by default}\\
% \hline
% \end{tabular}
% \end{adjustwidth}
% \end{table}
%
%
% \begin{table}[htbp]\caption{Supported color models}\label{tab.mod}
% \raggedleft
% \extrarowheight2pt
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabular}{l>{\em}l>{$}l<{$}rl}
% \hline
% \rowcolor{tableheadcolor}
% \emph{Name}  & Base colors/notions & \emph{Parameter range}& \multicolumn2{>{\columncolor{tableheadcolor}}l}{\emph{Default}}\\
% \Model{rgb} & red, green, blue & \left[0,1\right]^3&& \\
% \Model{cmy} & cyan, magenta, yellow & \left[0,1\right]^3&& \\
% \Model{cmyk} & cyan, magenta, yellow, black & \left[0,1\right]^4&& \\
% \Model{hsb} & hue, saturation, brightness & \left[0,1\right]^3&& \\
% \Model{Hsb} & hue\Circ\!, saturation, brightness & \left[0,H\right]\times\left[0,1\right]^2&$H=$& $\mkern-15mu\rangeHsb$\\
% \Model{tHsb} & hue\Circ\!, saturation, brightness & \left[0,H\right]\times\left[0,1\right]^2&$H=$& $\mkern-15mu\rangeHsb$\\
% \Model{gray} & gray & \left[0,1\right]&& \\
% \Model{RGB} & Red, Green, Blue & \{0,1,\dots,L\}^3& $L\,=$& $\mkern-15mu\rangeRGB$\\
% \Model{HTML} & RRGGBB & \{\texttt{000000},\dots,\texttt{FFFFFF}\}&& \\
% \Model{HSB} & Hue, Saturation, Brightness & \{0,1,\dots,M\}^3& $M=$& $\mkern-15mu\rangeHSB$\\
% \Model{Gray} & Gray & \{0,1,\dots,N\}& $N\,=$& $\mkern-15mu\rangeGray$\\
% \Model{wave} & lambda \emph{(nm)}& \left[363,814\right]&& \\
% \hline\hline
% \multicolumn5{c}{$L,M,N$ are positive integers; $H$ is a positive real number}\\
% \hline
% \end{tabular}
% \end{table}
%
%
% \subsubsection{Executing additional initialisation commands}
%
% \DescribeMacro\xcolorcmd
% Here is a simple interface to pass commands that should be executed at the end of the \XCP{} (immediately before the initialising |\color{black}| is executed).
% Just say |\def\xcolorcmd|\marg{commands} at some point before \XC{} is loaded.
%
% Example: assuming that |a.tex| is a complete \LaTeX{} document, a command like
% `|latex \def\xcolorcmd{\colorlet{black}{red}}\input{a}|'
% at the console generates a file |a.dvi| with all occurences of \Color{black} being replaced by \Color{red}, without the necessity to change the source file itself.
% (The exact spelling of the console command might vary across operating systems and \TeX{} distributions.)
%
%
%
% \subsection{Color models}
%
% \subsubsection{Supported color models}
%
% The list of supported color models and their parameter ranges is given in table \vref{tab.mod}.
% We emphasize that this color support is independent of the chosen driver.
%
% `Color model support' also means that it is possible to specify colors directly with their parameters, e.g., by saying |\textcolor[cmy]{0.7,0.5,0.3}{foo}| (\textcolor[cmy]{0.7,0.5,0.3}{foo}) or |\textcolor[HTML]{AFFE90}{foo}| (\textcolor[HTML]{AFFE90}{foo}).
%
% \paragraph{\Model{rgb}, \Model{cmyk}, \Model{hsb}, \Model{gray}}
% These are the models supported by \Index{PostScript} directly.
% We therefore refer to \cite{plrm} for a description of their properties and relations.
% There is a special command
% \DescribeMacro\adjustUCRBG
% to fine-tune the mechanisms of \emph{undercolor-removal} and \emph{black-generation} during conversion to the \Model{cmyk} model, see section \vref{sec.cmy2cmyk} for details.
%
% \paragraph{\Model{cmy}}
% This is mainly a model for intermediary calculation steps.
% With respect to that, it is a simple complement of \Model{rgb}.
% As far as visualisation is concerned, \Model{cmy} is treated as \Model{cmyk} with $k=0$.
%
% \paragraph{\Model{HTML}}
% This is a model derived from \Model{rgb} in order to enable input of color parameters from web pages or CSS files.
% Therefore, it is not really a color model of its own right, but rather a user interface for convenience.
% It is worth mentioning that \Model{HTML} accepts any combination of the characters |0|--|9|, |A|--|F|, |a|--|f|, as long as the string has a length of exactly 6~characters.
% However, outputs of conversions to \Model{HTML} will always consist of numbers and \emph{uppercase} letters.
%
% \paragraph{\Model{Hsb}, \Model{tHsb}}
% Firstly, \Model{Hsb} is a `user interface' model, mapping $\emph{hue}\in[0,1]$ onto $\emph{hue\Circ}\in[0,H]$, where $H$ is given by |\def\rangeHsb|\marg{H}.
% \DescribeMacro\rangeHsb
% Thus, if $H=360$, we can think of a circle or wheel to specify the \emph{hue\Circ} parameter.
% Secondly, \Model{Hsb} is the basis for \Model{tHsb}, also named \pModel{tuned} \Model{Hsb}, which enables the user to apply a piecewise linear transformation on \emph{hue\Circ} by shifting selected \emph{hue\Circ} values forward or backward on the circle.
% This transformation is defined by |\def\rangetHsb{|$x_1,y_1;x_2,y_2;\dots$|}|
% \DescribeMacro\rangetHsb
% which specifies that $\emph{hue\Circ}=x_1$ in \Model{tHsb} means $\emph{hue\Circ}=y_1$ in \Model{Hsb}, etc.
% For example, \Color{yellow} is at 60\Circ{} in the \Model{Hsb} circle (\Color{red} being at 0\Circ), however, in most color wheels used by artists, \Color{yellow} is at 120\Circ.
% Therefore, a `|120,60|' entry would make sense if we planned to replicate an artist's color wheel via \Model{tHsb}.
% See section \vref{sec.tHsb2Hsb} for the exact transformation formula and further restrictions, and section \vref{sec.harmony} for color wheels and color harmonies.
% Figure \vref{fig.tHsb} may serve for comparison purposes.
%
% Example: `|\def\rangetHsb{|\texttt{\rangetHsb}|}|' is in fact \XC's default setting.
%
% \paragraph{\Model{wave}}
% With this model we try to make wavelengths transformable to standard color models, in order to approximate the visual appearance of light waves.
% While the visible spectrum covers a range of approximately 400--750\,nm, the implementation in \XC{} generally allows for all real `wavelengths' $\lambda$ that have an absolute value less than \csname strip@pt\endcsname\maxdimen{} (the biggest number \TeX{} can represent as a dimension).
% However, the probability of getting any non-black color outside the range of $\lambda\in[363,814]$ is exactly zero.
% Therefore, figure \vref{fig.spectrum} illustrates only the mentioned wavelength interval.
% Note that it is not possible to convert other models to \Model{wave} in a sensible way, since the latter covers only a limited range of colors.
%
% \paragraph{\Model{RGB}, \Model{HSB}, \Model{Gray}}
% These are derived models, turning the continuous $[0,1]$ parameter ranges of \Model{rgb}, \Model{hsb}, and \Model{gray} to finite sets of integers; we therefore use the term \emph{integer models}.
% The constants $L, M, N$ of table \ref{tab.mod} are defined via the commands |\def\rangeRGB|\marg{L},
% \DescribeMacro\rangeRGB
% |\def\rangeHSB|\marg{M},
% \DescribeMacro\rangeHSB
% and |\def\rangeGray|\marg{N}.
% \DescribeMacro\rangeGray
% Changes of these constants can be done \emph{before} or \emph{after} the \XCP{} is loaded, e.g.,
% \label{ex.range}\begin{verbatim}
% \documentclass{article}
% ...
% \def\rangeRGB{15}
% \usepackage[dvips]{xcolor}
% ...
% \GetGinDriver
% \usepackage[\GinDriver]{hyperref}
% ...
% \begin{document}
% ...
% \def\rangeRGB{63}
% ...
% \end{verbatim}
%
%
% \subsubsection{Substituting individual color models}\label{sec.subst}
%
% \DescribeMacro\substitutecolormodel
%   \marg{source model}\marg{target model-list}\\
% Substitute \Meta{source model} by the first actually present model that occurs in \Meta{target model-list}.
% Only color models of type \Meta{num model} are allowed;
% all changes are local to the current group, but a prepended |\xglobal| is obeyed.
%
% Example: assume the actual driver has an incorrect implementation of \Model{hsb} whereas \Model{rgb} looks well.
% Then |\substitutecolormodel{hsb}{rgb}| could be a good choice, since it converts --- from that point onwards --- all definitions of \Model{hsb} colors by \XC's algorithms into \Model{rgb} specifications, without touching other models.
%
%
% \subsubsection{Changing the target color model within a document}\label{sec.tgt}
%
% \DescribeMacro\selectcolormodel
%   \marg{num model}\\
% Sets the target model to \Meta{num model}, where the latter is one of the model names allowed as package option (i.e., \Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}), see figure \vref{fig.tgt} for an example.
% There are two possible hooks, where the conversion to the target model can take place:
% \begin{itemize}
% \item \DescribeMacro\ifconvertcolorsD at color \emph{definition} time\footnote{This means that all \emph{newly} defined colors will be first converted to the target model, then saved.} (i.e., within |\definecolor| and friends); this is controlled by the switch |\ifconvertcolorsD|;
% \item \DescribeMacro\ifconvertcolorsU at time of color \emph{usage} (immediately before a color is displayed, therefore covering colors that have been defined in other models or that are being specified directly like |\color[rgb]{.1,.2,.3}|); this is controlled by the switch |\ifconvertcolorsU|.
% \end{itemize}
% Both switches are set to `true' by selecting any of the models, except \Option{natural}, which sets them to `false'.
% This applies for selection via a package option as well as via |\selectcolormodel|.
% Why don't we simply convert all colors at time of usage?
% If many colors are involved, it can save some processing time when all conversions are already done during color definitions.
% Best performance can be achieved by |\usepackage[rgb,...]{xcolor}\convertcolorsUfalse|, which is actually the way how \XC{} worked up to version 1.07.
%
%
% \begin{table}[p]\caption{Arguments and terminology}\label{tab.term}
% \def\RS{\ensuremath{\to}\space}
% \footnotesize\raggedleft
% \extrarowheight2pt
% \begin{adjustwidth}{-2.5cm}{}
% \advance\textwidth2.5cm
% \tabcolsep.25em
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabularx}{\textwidth}{lX}
% \hline
% \rowcolor{tableheadcolor}
% \em Element & \em Replacement string\\
% \Meta*{empty}& \RS empty string `'\\
% \Meta*{minus}& \RS non-empty string consisting of one or more minus signs `|-|'\\
% \Meta*{plus}& \RS non-empty string consisting of one or more plus signs `|+|'\\
% \hline
% \Meta*{int}& \RS integer number\hfill(\emph{integer})\\
% \Meta*{num}& \RS non-negative integer number\hfill(\emph{number})\\
% \Meta*{dec}& \RS real number\hfill(\emph{decimal})\\
% \Meta*{div}& \RS non-zero real number\hfill(\emph{divisor})\\
% \Meta*{pct}& \RS real number from the interval $[0,100]$\hfill(\emph{percentage})\\
% \hline
% \Meta*{id}& \RS non-empty string consisting of letters and digits\hfill(\emph{identifier})\\
% \Meta*{ext id}& \RS \Meta{id}\newline
%                 \RS \Meta[1]{id}|=|\Meta[2]{id}\\
% \Meta*{id-list}& \RS \Meta[1]{ext id}|,|\Meta[2]{ext id}|,...,|\Meta[l]{ext id}\\
% \Meta*{name}& \RS \Meta{id}\hfill(\emph{explicit name})\newline
%               \RS `|.|'\hfill(\emph{implicit name})\\
% \Meta*{core model}& \RS `|rgb|', `|cmy|', `|cmyk|', `|hsb|', `|gray|'\hfill(\emph{core models})\\
% \Meta*{num model}& \RS \Meta{core model}\newline
%                    \RS `|RGB|', `|HTML|', `|HSB|', `|Gray|'\hfill(\emph{integer models})\newline
%                    \RS `|Hsb|', `|tHsb|', `|wave|'\hfill(\emph{decimal models})\\
% \Meta*{model}& \RS \Meta{num model}\hfill(\emph{numerical models})\newline
%                \RS `|named|'\hfill(\emph{pseudo model})\\
% \Meta*{model-list}& \RS \Meta[1]{model}|/|\Meta[2]{model}|/.../|\Meta[m]{model} \hfill(\emph{multiple models})\newline
%                     \RS \Meta{core model}|:|\Meta[1]{model}|/|\Meta[2]{model}|/.../|\Meta[m]{model}\\
% \Meta*{spec}& \RS comma-separated list of numerical values\hfill(\emph{explicit specification})\newline
%               \RS space-separated list of numerical values\hfill(\emph{explicit specification})\newline
%               \RS name of a `named' color\hfill(\emph{implicit specification})\\
% \Meta*{spec-list}& \RS \Meta[1]{spec}|/|\Meta[2]{spec}|/.../|\Meta[m]{spec} \hfill(\emph{multiple specifications})\\
% \Meta*{type}& \RS \Meta{empty}\newline
%               \RS `|named|', `|ps|'\\
% \hline
% \Meta*{expr}& \RS \Meta{prefix}\Meta{name}\Meta{mix expr}\Meta{postfix}\hfill(\emph{standard color expression})\\
% \Meta*{prefix}& \RS \Meta{empty}\newline
%                 \RS \Meta{minus}\hfill(\emph{complement indicator})\\
% \Meta*{mix expr}& \RS |!|\Meta[1]{pct}|!|\Meta[1]{name}|!|\Meta[2]{pct}|!|\Meta[2]{name}|!...!|\Meta[n]{pct}|!|\Meta[n]{name} \hfill(\emph{complete mix expr.})\newline
%                   \RS |!|\Meta[1]{pct}|!|\Meta[1]{name}|!|\Meta[2]{pct}|!|\Meta[2]{name}|!...!|\Meta[n]{pct} \hfill(\emph{incomplete mix expr.})\\
% \Meta*{postfix}& \RS \Meta{empty}\newline
%                  \RS |!!|\Meta{plus}\hfill(\emph{series step})\newline
%                  \RS |!![|\Meta{num}|]|\hfill(\emph{series access})\\
% \hline
% \Meta*{ext expr}& \RS \Meta{core model}|,|\Meta{div}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}\newline
%                   \RS \Meta{core model}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}\\
% \hline
% \Meta*{func expr}& \RS |>|\Meta{function}|,|\Meta[1]{arg}|,|\Meta[2]{arg}|,...,|\Meta[j]{arg}\hfill(\emph{color function expression})\\
% \Meta*{function}& \RS `|wheel|', `|twheel|'\hfill(\emph{color functions})\\
% \hline
% \Meta*{color}& \RS \Meta{color expr}\Meta[1]{func expr}\Meta[2]{func expr}|...|\Meta[i]{func expr}\\
% \Meta*{color expr}& \RS \Meta{name}\newline
%                     \RS \Meta{expr}\newline
%                     \RS \Meta{ext expr}\\
% \hline\hline
% \rowcolor{white}
% Remarks:& Each \RS denotes a possible replacement string for the element in the left column;
%           however, further context-dependent restrictions may apply.
%           See main text for details.
%           A string `|foo|' is always to be understood without the quotes.
%           $i,j,k,l,m,n$ denote non-negative integers, $k,l,m,n>0$, $m\le8$.\\
% \hline
% \end{tabularx}
% \end{adjustwidth}
% \end{table}
%
%
%
% \subsection{Arguments and terminology}\label{sec.term}
%
% Before we describe \XC's color-related commands in detail, we define several elements or identifiers that appear repeatedly within arguments of those commands.
% A general syntax overview is given in table \vref{tab.term}.
%
%
% \subsubsection{Additional remarks and restrictions on arguments}
%
% \paragraph{Basic strings and numbers}
% \DescribeArg{empty}
% \DescribeArg{minus}
% \DescribeArg{plus}
% \DescribeArg{int}
% \DescribeArg{num}
% \DescribeArg{dec}
% \DescribeArg{pct}
% \DescribeArg{div}
% These arguments do not need much explanation.
% However, as far as numerical values are concerned, it is noteworthy that real numbers in (La)\TeX{} are --- as long as they are to be used in the context of lengths, dimensions, or skips --- are restricted to a maximum absolute value $<16384$.
% Certainly, in a chain of numerical calculations, this constraint has also to be obeyed for every single interim result, which usually implies further range restrictions.
% Since \XC{} makes extensive use of \TeX's internal dimension registers for most types of calculations, this should be kept in mind whenever \Meta{ext expr} expressions are to be used.
%
%
% \paragraph{Color names}
% \DescribeArg{name}
% A \Meta{name} denotes the declared name (or the name to be declared) of a \emph{color} or a \emph{color series};
% it may be declared \emph{explicitly} by one of the following commands: |\definecolor|, |\providecolor|, |\colorlet|, |\definecolorset|, |\providecolorset|, |\definecolorseries|, |\definecolors|, |\providecolors|.
% On the other hand, the reserved color name `|.|' is declared \emph{implicitly} and denotes the \emph{current color}.
% Actually, besides letters and digits, certain other characters do also work for \Meta{name} declarations, but the given restriction avoids misunderstandings and ensures compatibility with future extensions of \XC.
%
% Examples: `|red|', `|MySpecialGreen1980|', `|.|'.
%
%
% \paragraph{Color models}
% \DescribeArg{core model}
% \DescribeArg{num model}
% \DescribeArg{model}
% The differentiation between \emph{core models} (\Model{rgb}, \Model{cmy}, \Model{cmyk}, \Model{hsb}, \Model{gray}), \emph{integer models} (\Model{RGB}, \Model{HTML}, \Model{HSB}, \Model{Gray}), \emph{decimal models} (\Model{Hsb}, \Model{tHsb}, \Model{wave}) and \emph{pseudo models} (currently \nModel{named}, \nModel{ps}) has a simple reason: core models with their parameter ranges based on the unit interval $[0,1]$ are best suited for all kinds of calculations, whereas the purpose of the integer models is mainly to facilitate the input of parameters, followed by some transformation into one of the core models.
% Finally, the decimal models \Model{Hsb} and \Model{tHsb} are special-purpose versions of \Model{hsb}, whereas \Model{wave} and the pseudo model \nModel{named} have a special status, since they are `calculation-averse': it is usually only possible to convert such a color into one of the other models, but not the other way round.
% Even worse for the pseudo model \nModel{ps}: since such colors contain \Index{PostScript} code, they are absolutely intransparent for \TeX.
%
%
% \paragraph{Color specifications}
% \DescribeArg{spec}
% The \Meta{spec} argument --- which specifies the parameters of a color --- obviously depends on the underlying color model.
% We differentiate between \emph{explicit} and \emph{implicit} specification, the former referring to numerical parameters as explained in table \vref{tab.mod}, the latter --- ideally --- referring to driver-provided names.
%
% Examples: `|.1,.2,.3|', `|.1 .2 .3|', `|0.56789|', `|89ABCD|', `|ForestGreen|'.
%
%
% \paragraph{Multiple models and specifications}
% \DescribeArg{model-list}
% \DescribeArg{spec-list}
% These arguments always appear in (explicit or implicit) pairs within the following color definition commands:
% |\definecolor|, |\providecolor|, |\definecolorset|, |\providecolorset|.
% First, \Meta{model-spec} is being reconciled with the current target model (as set by a package option or the |\selectcolormodel| command); in case there is no exact match, the first model of the list is chosen.
% Then, the corresponding color specification will be selected from \Meta{spec-list}, such that we arrive at a proper $(\Meta{model}, \Meta{spec})$ pair.
% Therefore, in the actual executed color definition there is no ambiguity anymore.
% The extended form \Meta{core model}|:|\Meta[1]{model}|/|\Meta[2]{model}|/.../|\Meta[m]{model} causes an immediate conversion of the relevant \Meta{spec} to \Meta{core model}; an unknown target model will be silently ignored here.
%
% Examples: `|rgb/cmyk/named/gray|', `|0,0,0/0,0,0,1/Black/0|', `|rgb:cmy/hsb|'.
%
%
% \paragraph{The type argument}
% \DescribeArg{type}
% This is used only in the context of color defining commands, see the description of |\definecolor| and friends.
%
%
% \paragraph{Standard color expressions}
% \DescribeArg{expr}
% \DescribeArg{prefix}
% \DescribeArg{mix expr}
% \DescribeArg{postfix}
% These expressions serve as a tool to easily specify a certain form of cascaded color mixing which is described in detail in section~\ref{sec.expr-meaning}.
% The \Meta{prefix} argument controls whether the color following thereafter or its complement will be relevant:
% an odd number of minus signs indicates that the color resulting from the remaining expression has to be converted into its complementary color.
% An \emph{incomplete mix expression} is just an abbreviation for a \emph{complete mix expression} with $\Meta[n]{name} = |white|$, in order to save some keystrokes in the case of tints.
% The \Meta{postfix} string is usually empty, but it offers some additional functionality in the case of a \emph{color series}:
% the non-empty cases require that
% \begin{itemize}
% \item \Meta{name} denotes the name of a \emph{color series},
% \item \Meta{mix expr} is a \emph{complete} mix expression.
% \end{itemize}
% Examples: `|red|', `|-red|', `|--red!50!green!12.345|', `|red!50!green!20!blue|', `|foo!!+|', `|foo!![7]|', `|foo!25!red!!+++|', `|foo!25!red!70!green!![7]|'.
%
%
% \paragraph{Extended color expressions}
% \DescribeArg{ext expr}
% These expressions provide another method of color mixing, see section \vref{sec.extexpr-meaning} for details.
% The shorter form
% \begin{align*}
% \Meta{core model}&|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|!|\Meta[k]{dec}\\
% \intertext{is an abbreviation for the special (and probably most used) case}
% \Meta{core model}|,|\Meta{div}&|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|!|\Meta[k]{dec}\\
% \intertext{with the following definition (requiring a non-zero sum of all \Meta[\kappa]{dec} coefficients):}
% \Meta{div} &:= \Meta[1]{dec} + \Meta[2]{dec} + \dots + \Meta[k]{dec} \neq0.
% \end{align*}
% Examples: `|rgb:red,1|', `|cmyk:red,1;-green!25!blue!60,11.25;blue,-2|'.
%
%
% \paragraph{Function expressions}
% \DescribeArg{func expression}
% \DescribeArg{function}
% These expressions extend the functionality of \emph{standard} or \emph{extended} expressions by taking the result of such an expression to perform additional calculations.
% The number of arguments may vary between different functions, see section \vref{sec.functions} for details.
%
% Examples: `|>wheel,30|', `|>wheel,30,|', `|>twheel,1,12|', `|>twheel,-11,12|'.
%
%
%
% \paragraph{Colors}
% \DescribeArg{color}
% \DescribeArg{color expr}
% Finally, \Meta{color} is the `umbrella' argument, covering the different concepts of specifying colors.
% This means, whenever there is a \Meta{color} argument, the full range of names and expressions, as explained above, may be used.
%
%
% \subsubsection{Meaning of standard color expressions}\label{sec.expr-meaning}
%
% We explain now how an expression
% \begin{gather*}
% \Meta{prefix}\Meta{name}|!|\Meta[1]{pct}|!|\Meta[1]{name}|!|\Meta[2]{pct}|!|\dots|!|\Meta[n]{pct}|!|\Meta[n]{name}\Meta{postfix}
% \end{gather*}
% is being interpreted and processed:
% \begin{enumerate}
% \item First of all, the model and color parameters of \Meta{name} are extracted to define a temporary color \Meta{temp}.
% If \Meta{postfix} has the form `|!![|\Meta{num}|]|', then \Meta{temp} will be the corresponding (direct-accessed) color \Meta{num} from the series \Meta{name}.
% \item Then a color mix, consisting of \Meta[1]{pct}\% of color \Meta{temp} and $(100-\Meta[1]{pct})$\% of color \Meta[1]{name} is computed; this is the new temporary color \Meta{temp}.
% \item The previous step is being repeated for all remaining parameter pairs (\Meta[2]{pct},\Meta[2]{name}), \dots, (\Meta[n]{pct},\Meta[n]{name}).
% \item If \Meta{prefix} consists of an odd number of minus signs `-', then \Meta{temp} will be changed into its complementary color.
% \item If \Meta{postfix} has the form `|!!+|', `|!!++|', `|!!+++|', etc., a number of step commands (=~number of `|+|' signs) are performed on the underlying color series \Meta{name}.
% This has no consequences for the color \Meta{temp}.
% \item Now the color \Meta{temp} is being displayed or serves as an input for other operations, depending on the invoking command.
% \end{enumerate}
% Note that in a typical step 2 expression \Meta{temp}|!|\Meta[\nu]{pct}|!|\Meta[\nu]{name}, if \Meta[\nu]{pct}=100 resp.{} \Meta[\nu]{pct}=0, the color \Meta{temp} resp.{} \Meta[\nu]{name} is used without further transformations.
% In the true mix case, $0<$\Meta[\nu]{pct}$<100$, the two involved colors may have been defined in different color models, e.g., |\definecolor{foo}{rgb}{...}| and |\definecolor{bar}{cmyk}{...}|.
% In general, the second color, \Meta[\nu]{name}, is transformed into the model of the first color, \Meta{temp}, then the mix is calculated within that model.\,\footnote{Exception: in order to avoid strange results, this rule is being reversed if \Meta{temp} origins from the \Model{gray} model; in this case it is converted into the underlying model of \Meta[\nu]{name}.}
% Thus, \Meta{temp}|!|\Meta[\nu]{pct}|!|\Meta[\nu]{name} and \Meta[\nu]{name}|!|\Meta[\nu]{$100-$pct}|!|\Meta{temp}, which should be equivalent theoretically, will not necessarily yield identical visual results.
%
% Figures \vrefrange{fig.expr}{fig.ex} show some first applications of colors and expressions.
% More examples are given in figure \vref{fig.progress}.
% Over and above that, a large set of color examples can be found in \cite{chroma}.
%
%
% \subsubsection{Meaning of extended color expressions}\label{sec.extexpr-meaning}
%
% An \emph{extended color expression}
% \begin{gather*}
% \Meta{core model}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}
% \end{gather*}
% mimes color mixing as painters do it: specify a list of colors, each with a \Meta{dec} factor attached to.
% For such an \Meta{ext expr}, each standard color expression \Meta[\kappa]{expr} will be converted to \Meta{core model}, then the resulting vector is multiplied by $\Meta[\kappa]{dec}/\Meta{div}$, where
% \begin{gather*}
% \Meta{div} := \Meta[1]{dec} + \Meta[2]{dec} + \dots + \Meta[k]{dec}.
% \end{gather*}
% Afterwards the sum of all of these vectors is calculated.
%
% Example: mixing 4~parts of \testclr{red} \Color{red}, 2~parts of \testclr{green} \Color{green}, and 1~part of \testclr{yellow} \Color{yellow}, we get \testclr{rgb:red,4;green,2;yellow,1} via |\color{rgb:red,4;green,2;yellow,1}|.
% Trying the same with $-1$ parts of \Color{yellow} instead, we get \testclr{rgb:red,4;green,2;yellow,-1}.
% Note that this mechanism can also be used to display an individual color (expression) in a certain color model: |\color{rgb:yellow,1}| results in such a conversion.
% The general form
% \begin{gather*}
% \Meta{core model}|,|\Meta{div}|:|\Meta[1]{expr}|,|\Meta[1]{dec}|;|\Meta[2]{expr}|,|\Meta[2]{dec}|;...;|\Meta[k]{expr}|,|\Meta[k]{dec}
% \end{gather*}
% does the same operation with the only difference that the divisor \Meta{div} is being specified instead of calculated.
% In the above example, we get a shaded version \testclr{rgb,9:red,4;green,2;yellow,1} via |\color{rgb,9:red,4;green,2;yellow,1}|.
% Note that it is not forbidden to specify a \Meta{div} argument which is smaller than the sum of all \Meta[\kappa]{dec}, such that one or more of the final color specification parameters could be outside the interval $[0,1]$.
% However, the mapping of equation (\ref{eq.U}) takes care of such cases.
%
%
% \subsubsection{Color functions}\label{sec.functions}
%
% Color functions take a comma-separated list of arguments, and they serve to transform the \emph{given color} (i.e., the result of all calculations prior to the function call) into a new color.
%
% \paragraph{Color wheel calculations}
% \DescribeFunc{wheel}
% \DescribeFunc{twheel}
% Arguments: \Meta{angle} or \Meta{angle}|,|\Meta{full circle}, the former being an abbreviataion of \Meta{angle}|,\rangeHsb|.
% These functions allow to calculate related colors by harmonic relations based on color wheels (cf.~section \vref{sec.harmony}).
% The second argument \Meta{full circle} declares how many units a full circle consists of, the first argument states by how many units the given color has to be rotated.
% To this end, the given color is first converted to \Model{Hsb} (in case of \Function{wheel}), yielding \emph{hue\Circ}, \emph{saturation}, and \emph{brightness}, respectively.
% Then
% \begin{gather}
% \displaystyle\emph{hue\Circ} := \emph{hue\Circ} + \frac{\Meta{angle}}{\Meta{full circle}}\cdot H, \qquad \emph{hue} := u\Bigl( \frac{\emph{hue\Circ}}{H} \Bigr)
% \end{gather}
% where $u$ is the range-reduction function of equation~(\ref{eq.U}) and $H = \texttt{\string\rangeHsb}$.
% With \emph{saturation} and \emph{brightness} left untouched, the final model is \Model{hsb}.
% The \Function{twheel} function works similarly, but its arguments refer to \Model{tHsb} instead of \Model{Hsb}.
% Examples are shown in figure \vref{fig.harmony}.
%
%
% \subsection{Predefined colors}
%
% \subsubsection{Colors that are always available}
%
% \def\test#1{\testclr{#1}~\Color{#1}}
% Within \File{xcolor.sty}, the following color names are defined:
% \test{red}, \test{green}, \test{blue}, \test{cyan}, \test{magenta}, \test{yellow}, \test{black}, \test{gray}, \test{white}, \test{darkgray}, \test{lightgray}, \test{brown}, \test{lime}, \test{olive}, \test{orange}, \test{pink}, \test{purple}, \test{teal}, \test{violet}.
%
% This base set of colors can be used without restrictions in all kinds of color expressions, as explained in section \vref{sec.term}.
%
%
% \subsubsection{Additional sets of colors}\label{sec.additionalcolors}
%
% There are also sets of color names that may be loaded by \XC{} via package options, available in two variants:
% a `normal' version (e.g., \Option{dvipsnames}) and a `starred' version (e.g., \Option{dvipsnames*}).
% The first variant simply defines all the colors \emph{immediately}, whereas the second applies the mechanism of \emph{deferred} definition.
% In the latter case, individual color names have to be activated by |\definecolors| or |\providecolors| commands, as described in section \vref{sec.deferred}, before they can be applied in a document.
% \begin{itemize}
% \item \Option{dvipsnames}/\Option{dvipsnames*} loads a set of 68 \Model{cmyk} colors as defined in the |dvips| driver. However, these colors may be used in all supported drivers.
% \item \Option{svgnames}/\Option{svgnames*} loads a set of 151 \Model{rgb} color names\footnote{In fact, these names represent 141 different colors.} according to the \Index{SVG}~1.1 specification \cite{svg}\footnote{Actually, the cited specification lists only lowercase names, and the original definitions are given in \Model{RGB} parameters, converted to \Model{rgb} by the author.}, enhanced by~4 names taken from the file \File{rgb.txt} which is part of \Index{Unix}/\Index{X11} distributions. Note that \Index{HTML4} accepts a subset of 16~color keywords (using identical specifications), see \cite{HTML4} and section \vref{sec.names}.
% \item \Option{x11names}/\Option{x11names*} loads a set of 317 \Model{rgb} color names\footnote{These names represent 315 different colors.} that are basically variations of a subset of the \Index{SVG} set mentioned before, according to the file \File{rgb.txt} which is part of \Index{Unix}/\Index{X11} distributions\footnote{Again, the original definitions are given in \Model{RGB} parameters, converted to \Model{rgb} by the author.}.
% We describe now how to access all 752 color names of \File{rgb.txt} without much effort:
% \begin{itemize}
% \item Load \Option{x11names} as well as \Option{svgnames}.
% \item Capitalise initials and skip blanks: \Color[-]{DarkSlateGray} instead of \Color[-]{dark slate gray}.
% \item \Index{X11} names without numbers are identical to the corresponding \Index{SVG} colors, except in 5~cases:
% use \Color{Gray0}, \Color{Grey0}, \Color{Green0}, \Color{Maroon0}, \Color{Purple0} instead of \Color[-]{Gray}, \Color[-]{Grey}, \Color[-]{Green}, \Color[-]{Maroon}, \Color[-]{Purple} to obtain the original \Index{X11} colors.
% \item For $N=0,1,\dots,100$ use `|[gray]{|$N/100$|}|' or `|black!|$100-N$' instead of \Color[-]{grayN} or \Color[-]{greyN}.
% \end{itemize}
% \end{itemize}
% The color names and corresponding displays are listed in section \vref{sec.names}.
% Section \vref{sec.clash} describes how to deal with name clashs while using both \Option{svgnames} and \Option{dvipsnames} in the same document.
% See also \cite{chroma} for a systematic set of color and mix examples.
%
%
% \subsection{Color definition}\label{sec.def}
%
% \subsubsection{Ordinary and named colors}\label{sec.prologue}
%
% In the \LCP{} there is a distinction between `colors' (defined by the command |\definecolor|) and `named colors' (defined by |\DefineNamedColor|, which is allowed only in the preamble).
% Whenever an ordinary color is being used in a document, it will be translated into a |\special| command that contains a --- driver-specific --- numerical description of the color which is written to the \File{.dvi} file.
% On the other hand, named colors offer the opportunity to store numerical values at a central place whereas during usage, colors may be identified by their names, thus enabling post-processing if required by the output device.
%
% All drivers delivered with the standard \Package{graphics} package support the \emph{formalism} of defining and invoking `named colors'.
% However, real support for the \emph{concept} behind that, i.e.~employing names instead of parameters, ranges from `none' to `complete'.
% We demonstrate the current situation for three different drivers:
% \begin{itemize}
% \item \Option{dvips} has very good support for the `named' concept; the \Index{PostScript} equivalents to the color names defined by \Option{dvipsnames} are being loaded -- unless switched off -- by \Program{dvips} automatically.
% However, additional names have to be made known to the \Index{PostScript} interpreter by some kind of header file.
% Since version 2.01, \XC{} offers an integrated solution for this task: by invoking the package option \Option{prologue}, a \Index{PostScript} header file \File{xcolor.pro} is loaded by \Program{dvips}.
% Additionally, under this option every color definition command\footnote{This is not only true for the document preamble, but for the document body as well.} (|\definecolor|, |\colorlet|, etc.) will generate some \Index{PostScript} code that is written to an auxiliary file with the extension \File{.xcp} (shortcut for \textbf{xc}olor \textbf prologue).
% This file is as well loaded by \Program{dvips} as a prologue, thus making all color names available to the \Index{PostScript} interpreter.
% Of course, the \File{.xcp} file may be edited before \Program{dvips} is applied, making it easy to change device-specific color parameters at a central place.
% Note that the \Index{PostScript} code is designed similar to \File{color.pro}: only \emph{new} names are defined.
% This allows to preload other prologue files with color definitions that are not being destroyed by \XC.
% On the other hand, it requires the user to take care about redefining color names.\\
% Example: |\colorlet{foo}{red}\colorlet{foo}{blue}\color{foo}| will switch to \Color{blue} in the usual \XC{} logic, however the \File{.ps} file would display \Color{red} (unless \Color{foo} had been defined differently before).\\
% It should be stressed that this mechanism is only employed by the \Option{prologue} option.
% Without that, the predefined `named' colors activated by the \Option{dvipsnames} option (without employing any tints, shades, color expressions, etc.) may be used in this way, all other `named' colors are unknown to \Index{PostScript}.
% \item \Option{dvipdfm} supports only the standard \Option{dvipsnames} colors since these are hard-coded in the \Program{dvipdfm} program itself; there seems to be no way to load any user-defined prologue files.
% \item \Option{pdftex} does not offer conceptual support, all `named' colors are converted immediately to their numerical representation. It therefore allows unrestricted definition and usage of named colors (although offering no added value through this).
% \end{itemize}
%
% Typically, a \File{.dvi} viewer will have difficulties to display user-defined `named' colors.
% For example, \Index{MiK\TeX}'s viewer \Program{Yap} currently displays only `named' colors from the \Option{dvipsnames} set.
% Thus, whenever the \Option{prologue} option is invoked together with \Option{dvips}, \emph{all} other colors will appear black.
% However, after employing \Program{dvips}, a \Index{PostScript} viewer should display the correct colors.
%
%
% \subsubsection{Color definition in \XC}
%
% \DescribeMacro\definecolor
%   \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\footnote{Prior to version 2.00, this command was called \cs{xdefinecolor}, the latter name still being available for compatibility reasons.}\\
% This is one of the commands that may be used to assign a \Meta{name} to a specific color.
% Afterwards, this color is known to the system (in the current group) and may be used in \emph{\Index{color expression}s}, as explained in section \vref{sec.term}.
% It replaces both \LC's |\DefineNamedColor| and |\definecolor|.
% Note that an already existing color \Meta{name} will be overwritten.
% The variable |\tracingcolors| controls whether such an overwriting will be logged or not (see section \vref{sec.info} for details).
% The arguments are described in section \vref{sec.term}.
% Hence, valid expressions for color definitions are
% \begin{itemize}
% \item |\definecolor{red}{rgb}{1,0,0}|,
% \item |\definecolor{red}{rgb/cmyk}{1,0,0/0,1,1,0}|,
% \item |\definecolor{red}{hsb:rgb/cmyk}{1,0,0/0,1,1,0}|,
% \item |\definecolor[named]{Black}{cmyk}{0,0,0,1}|,
% \item |\definecolor{myblack}{named}{Black}|,
% \end{itemize}
% where the last command is equivalent to |\colorlet{myblack}{Black}| (see below); the second command defines \Color{red} in the \Model{rgb} or \Model{cmyk} model, depending on the current setting of the \emph{target model}, whereas the third will additionally transform the color to \Model{hsb} prior to saving.
% Note that there is a special \Package{pstricks}-related version as described in section \vref{sec.pstricks}.
%
% \medskip
%
% \DescribeMacro\providecolor
%   \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\\
% Similar to |\definecolor|, but the color \Meta{name} is only defined if it does not exist already.
%
% \medskip
%
% \DescribeMacro\colorlet
%   \oarg{type}\marg{name}\oarg{num model}\marg{color}\\
% Copies the actual color which results from \Meta{color} to \Meta{name}.
% If \Meta{num model} is non-empty, \Meta{color} is first transformed to the specified model, before \Meta{name} is being defined.
% The pseudo model \nModel{named} is \emph{not} allowed here, it may, however, be specified in the \Meta{type} argument.
% Note that an already existing color \Meta{name} will be overwritten.
%
% Example: we said |\colorlet{tableheadcolor}{gray!25}| in the preamble of this document.
% In most of the tables we then formatted the first row by using the command |\rowcolor{tableheadcolor}|.
%
%
% \subsubsection{Defining sets of colors}
%
% \DescribeMacro\definecolorset
%   \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}\\
% This command facilitates the construction of \emph{\Index{color set}s}, i.e.~(possibly large) sets of individual colors with common underlying \Meta{model-list} and \Meta{type}.
% Here, \Meta{set spec} = \Meta[1]{name},\Meta[1]{spec-list};\dots;\Meta[l]{name},\Meta[l]{spec-list} ($l\ge1$ name/specification-list pairs).
% Individual colors are being constructed by single
% \begin{center}
% |\definecolor|\oarg{type}|{|\Meta{head}\Meta[\lambda]{name}\Meta{tail}|}|\marg{model-list}|{|\Meta[\lambda]{spec-list}|}|
% \end{center}
% commands, $\lambda=1,\dots,l$.
% For example,
% \begin{itemize}
% \item |\definecolorset{rgb}{}{}{red,1,0,0;green,0,1,0;blue,0,0,1}|\\
% could be used to define the basic colors \Color{red}, \Color{green}, and \Color{blue};\footnote{Actually, \XC{} uses a more complicated variant to provide the basic colors for different underlying models (see the source code for the full command):\\
% \cs{definecolorset\string{rgb/hsb/cmyk/gray\string}\string{\string}\string{\string}\string{red,1,0,0/0,1,1/0,1,1,0/.3;green,...\string}}.}
% \item |\definecolorset{rgb}{x}{10}{red,1,0,0;green,0,1,0;blue,0,0,1}|\\
% would define the colors \Color[-]{xred10}, \Color[-]{xgreen10}, and \Color[-]{xblue10}.
% \end{itemize}
%
% \DescribeMacro\providecolorset
%   \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}\\
% Similar to |\definecolorset|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
%
%
% \subsubsection{Immediate and deferred definitions}\label{sec.deferred}
%
% Traditionally, the definition of a color as described above leads to the immediate construction of a command that holds at least the information needed by the driver to display the desired color.
% Thus, defining 300 colors, e.g., by loading a huge set of predefined colors, will result in 300 new commands, although most of them --- except for the purpose of displaying lists of colors --- will hardly ever be used within a document.
% Along the development of computer memory --- increasing in size, decreasing in price --- recent \TeX{} implementations have increased their provisions for internal memory stacks that are available for strings, control sequences, etc.
% However, as memory continues to be finite, it may still be useful (or occasionally necessary) to have a method at hand that allows to reduce memory requirements a bit.
% This is the point where \emph{deferred color definition} comes into play.
% Its principle is simple: for every definition of this type (e.g., via |\preparecolor|), all necessary information is saved on a specific global \emph{\Index{definition stack}}, where it can be taken from later (e.g., via |\definecolors|) in order to construct the actual color command.
%
% Note that the following commands are only to be used in the document preamble, since the definition stack of colors for deferred definitions is deleted at the begin of the document body --- in order to save memory.
%
% \medskip
%
% \DescribeMacro\preparecolor
%   \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\\
% Similar to |\definecolor|, but the color \Meta{name} is not yet being defined: the arguments \Meta{model-list} and \Meta{spec-list} are evaluated immediately, then all necessary parameters (i.e.~\Meta{type}, \Meta{name}, \Meta{model}, \Meta{spec}) are put onto the \emph{\Index{definition stack}} for later usage.
%
% \medskip
%
% \DescribeMacro\preparecolorset
%   \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}
% \DescribeMacro\ifdefinecolors\\
% Similar to |\definecolorset|, but depending on the |\ifdefinecolors| switch: if set to `true', to each element of the set the command |\definecolor| (i.e.~immediate definition) is applied; if set to `false', |\preparecolor| (i.e.~deferred definition) is applied.
% For example, the package option \Option{svgnames} performs something like |\definecolorstrue\preparecolorset|, whereas \Option{svgnames*} acts like |\definecolorsfalse\preparecolorset|.
% Both options set |\definecolorstrue| at the end, in order to have a proper starting point for other color sets.
%
% \medskip
%
% \DescribeMacro\DefineNamedColor
%   \marg{type}\marg{name}\marg{model-list}\marg{spec-list}
% is provided mainly for compatibility reasons, especially to support the predefined colors in \File{dvipsnam.def}.
% It is the same as \Meta{cmd}\oarg{type}\marg{name}\marg{model}\marg{spec}, where \Meta{cmd} is either |\definecolor| or |\preparecolor|, depending on the state of |\ifdefinecolors|.
% Note that \LC's restriction to allow |\DefineNamedColor| only in the document preamble has been abolished in \XC.
%
% \medskip
%
% \DescribeMacro\definecolors
%   \marg{id-list}\\
% Recall that \Meta{id-list} has the form \Meta[1]{ext id}|,...,|\Meta[l]{ext id} where each \Meta[\lambda]{ext id} is either an identifier \Meta[\lambda]{id} or an assignment \Meta[\lambda']{id}|=|\Meta[\lambda]{id}.
% We consider the first case to be an abbreviation for \Meta[\lambda]{id}|=|\Meta[\lambda]{id} and describe the general case:
% the \Index{definition stack} is searched for the name \Meta[\lambda]{id} and its corresponding color parameters; if there is no match, nothing happens; if the name \Meta[\lambda]{id} is on the stack and its color parameters are \Meta[\lambda]{type}, \Meta[\lambda]{model}, and \Meta[\lambda]{spec}, then the command |\definecolor[|\Meta[\lambda]{type}|]{|\Meta[\lambda']{id}|}{|\Meta[\lambda]{model}|}{|\Meta[\lambda]{spec}|}| is executed.
% Thus, the user may control by which names the \emph{prepared} colors are to be used in the document.
% Note that the entry \Meta[\lambda]{id} is not removed from the stack, such that it can be used several times (even within the same |\definecolors| command).
%
% \medskip
%
% \DescribeMacro\providecolors
%   \marg{id-list}\\
% Similar to |\definecolors|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
%
%
% \subsubsection{Global color definitions}
%
% \DescribeMacro\ifglobalcolors
% By default, definitions via |\definecolor|, |\providecolor|, \dots{} are available only within the current group.
% By setting |\globalcolorstrue|, all such definitions are being made globally available --- until the current group ends.\footnote{The switch may also be set in the preamble in order to control the whole document.}
% \DescribeMacro\xglobal
% Another method to specify that an individual color definition is to be made global is to prefix it by |\xglobal|, e.g., |\xglobal\definecolor{foo}...|.
%
%
%
% \subsection{Color application}
%
% \subsubsection{Standard color commands}
%
% Here is the list of user-level color commands, as known from the \LCP, but with an extended syntax for the colors, allowing for expressions etc.:\\
% \DescribeMacro\color\marg{color}\\
% \oarg{model-list}\marg{spec-list}\\
% Switches to the color given either by name/expression or by model/specification.
% This color will stay in effect until the end of the current \TeX\ group.\\
% \DescribeMacro\textcolor\marg{color}\marg{text}\\
% \oarg{model-list}\marg{spec-list}\marg{text}\\
% are just alternative syntax for |\color|, in which the groups are added implicitly.
% Thus \meta{text} appears in the specified color, but then the color reverts to its previous value.
% Additionally, it calls |\leavevmode| to ensure the start of horizontal mode.\\
% \DescribeMacro\pagecolor\marg{color}\\
% \oarg{model-list}\marg{spec-list}\\
% Specifies the background color for the current, and all following, pages.
% It is a global declaration which does not respect \TeX\ groups.
%
% Remark: all of these commands except |\color| require that the \Meta{color} resp.\ \Meta{spec} arguments are put into curly braces |{}|, even if they are buried in macros.
%
% For example, after |\def\foo{red}|, one may say |\color\foo|, but one should always write |\textcolor{\foo}{bar}| instead of |\textcolor\foo{bar}| in order to avoid strange results.
%
% Note that color-specific commands from other packages may give unexpected results if directly confronted with color expressions (e.g., \Package{soul}'s |\sethlcolor| and friends).
% However, one can turn the expression into a name via |\colorlet| and try to use that name instead.
%
% \DescribeMacro\nopagecolor
% Removes any currently specified page color returning to the default transparent background.
% It is not yet supported by all driver options and so generates a warning if there is no definition in the driver file.
%
%
% \subsubsection{Colored boxes}\label{sec.fbox}
%
% \DescribeMacro\colorbox\marg{color}\marg{text}\\
% \oarg{model-list}\marg{spec-list}\marg{text}\\
% Takes the same argument forms as |\textcolor|, but the color specifies the \emph{background} color of the box.\\
% \DescribeMacro\fcolorbox\marg{frame color}\marg{background color}\marg{text}\\
% \oarg{model-list}\marg{frame spec-list}\marg{background spec-list}\marg{text}\\
% \oarg{fr.~model-list}\marg{fr.~spec-list}\oarg{backgr.~model-list}\marg{backgr.~spec-list}\marg{text}\\
% \marg{frame color}\oarg{background model-list}\marg{background spec-list}\marg{text}\\
% Puts a frame of the first color around a box with a background specified by the second color.
% If only the first optional argument is given, it specifies the color model for both colors.
% Besides the possibility to specify color \emph{expressions} as arguments, |\fcolorbox| now offers more flexibility for its arguments than the \LC{} version:
% \begin{itemize}
% \item \fcolorbox{gray}{yellow}{test} |\fcolorbox{gray}{yellow}{test}|,
% \item \fcolorbox[cmyk]{0,0,0,0.5}{0,0,1,0}{test} |\fcolorbox[cmyk]{0,0,0,0.5}{0,0,1,0}{test}|,
% \item \fcolorbox[gray]{0.5}[wave]{580}{test} |\fcolorbox[gray]{0.5}[wave]{580}{test}|,
% \item \fcolorbox{gray}[wave]{580}{test} |\fcolorbox{gray}[wave]{580}{test}|.
% \end{itemize}
% Additionally, |\fcolorbox| uses a new approach to frame drawing, which is an extension of \People{Donald}{Arseneau}'s suggestion in bug report latex/3655 \cite{fbox}.
% The main difference to \LaTeX's implementation is that box construction and frame drawing are split into separate operations, such that the frame is drawn \emph{after} the box contents has been constructed.
% This ensures that the frame is always on top of the box.
% \People{Donald}{Arseneau} improved speed as well as memory requirements of this approach.
% Furthermore, a new macro is introduced:
%
% \DescribeMacro\boxframe\marg{width}\marg{height}\marg{depth}\\
% Draws a frame with a linewidth of |\fboxrule|.
% Returns a |\hbox| with outer dimensions \meta{width}, \meta{height}, \meta{depth}.
% By this approach, a frame-primitive may also be provided by a driver file, in order to exploit driver-specific drawing facilities (see below).
% Again, this macro was optimised by \People{Donald}{Arseneau}.
%
% The new frame approach is used for |\fcolorbox| as well as \LaTeX's |\fbox| and |\framebox| commands, unless the \Option{kernelfbox} option is specified, which returns to \LaTeX's original definitions of |\f(rame)box|.
%
% Option \Option{xcdraw} uses \Index{PostScript} commands to draw frames and color boxes in case of the \Option{dvips} driver and \Index{PDF} code to draw frames in case of the \Option{pdftex} and \Option{dvipdfm} drivers.
% This is still experimental code that may confuse \File{.dvi} viewers.
% The opposite option \Option{noxcdraw} forces usage of the generic (driver-independent) code.
%
%
% \subsubsection{Using the current color}
%
% Within a color expression, `.' serves as a placeholder for the current color.
% See figure \vref{fig.cc} for an example.
%
% It is also possible to save the current color for later use, e.g., via the command |\colorlet{foo}{.}|.
%
% Note that in some cases the current color is of rather limited use, e.g., the construction of an |\fcolorbox| implies that at the time when the \Meta{background color} is evaluated, the current color equals the \Meta{frame color}; in this case `|.|' does not refer to the current color \emph{outside} the box.
%
%
% \subsubsection{Color testing}
%
% \DescribeEnv{testcolors}
%   \oarg{num models}\\
% This is a simple tabular environment in order to test (display) colors in different models, showing both the visual result and the model-specific parameters.
% The optional \Meta{num models} argument is a comma-separated list of \emph{numerical} color models (as usual without spaces) which form the table columns; the default list is
% {\makeatletter\ttfamily\let\@protected@testopt\@gobbletwo\edef\tmp{\testcolors}\expandafter\@firstofone\tmp}.
%
% \DescribeMacro\testcolor
%   \marg{color}\\
%   \oarg{model-list}\marg{spec-list}\\
% Each |\testcolor| command generates a table row, containing a display sample plus the respective parameters for each of the models.
% If the column-model matches the model of the color in question, its parameters are underlined.
% Note that this command is only available within the |testcolors| environment.
%
% For applications see figure \vref{fig.testcolors} and figures \ref{fig.tHsb}, \ref{fig.harmony}.
%
%
%
% \subsection{Color blending}
%
% The purpose of \emph{color blending} is to add some mixing color (expression) to all subsequent explicit color commands.
% Thus, it is possible to perform such a mix (or blend) operation for many colors without touching the individual commands.
%
% \medskip
%
% \DescribeMacro\blendcolors
%   \marg{mix expr}\\
% \DescribeMacro{\blendcolors*}
%   \marg{mix expr}\\
% Initialises all necessary parameters for color blending.
% The actual (completed) color blend expression is stored in |\colorblend|.
% In the starred version, the argument will be appended to a previously defined blend expression.
% An empty \Meta{mix expr} argument will switch blending off.
%
% Example: after |\blendcolors{!50!yellow}|, the colors \testclr{red} \testclr{green} \testclr{blue} are transformed into {\blendcolors{!50!yellow}\testclr{red} \testclr{green} \testclr{blue}, an additional |\blendcolors*{!50}| yields \blendcolors*{!50}\testclr{red} \testclr{green} \testclr{blue}}.
% \DescribeMacro\xglobal
% In order to achieve global scope, |\blendcolors| may be prefixed by |\xglobal|.
%
% Remark: color blending is applied only to \emph{explicit} color commands, i.e.~|\color|, |\fcolorbox| and the like.
% In the previous example the frames are not being blended because their color is set by an driver-internal command (switching back to the `current color').
% Thus, to influence these \emph{implicit} colors as well, we have to set the current color \emph{after} the blending:
% |\blendcolors{!50!yellow}\color{black}| results in {\blendcolors{!50!yellow}\color{black}\testclr{red} \testclr{green} \testclr{blue}, an additional |\blendcolors*{!50}\color{black}| yields \blendcolors*{!50}\color{black}\testclr{red} \testclr{green} \testclr{blue}}.
%
%
%
% \subsection{Color masks and separation}
%
% The purpose of \emph{color separation} is to represent all colors that appear in the document as a combination of a finite subset of base colors and their tints.
% Most prominent is \Model{cmyk} separation, where the base colors are \Color{cyan}, \Color{magenta}, \Color{yellow}, and \Color{black}, as required by the printers.
% This can be done by choosing the package option \Option{cmyk}, such that all colors will be converted in this model, and post-processing the output file.
% We describe now another --- and more general --- solution: \emph{color masking}.
% How does it work?
% Color masking is based on a specified color model \Meta{m-model} and a parameter vector \Meta{m-spec}.
% Whenever a color is to be displayed in the document, it will first be converted to \Meta{m-model}, afterwards each component of the resulting color vector will be multiplied by the corresponding component of \Meta{m-spec}.
% For example, let's assume that \Meta{m-model} equals |cmyk|, and \Meta{m-spec} equals $(\mu_c,\mu_m,\mu_y,\mu_k)$.
% Then an arbitrary color \Color{foo} will be transformed according to
% \begin{gather}
% \Color{foo} \mapsto (c,m,y,k) \mapsto (\mu_c\cdot c,\mu_m\cdot m,\mu_y\cdot y,\mu_k\cdot k)
% \end{gather}
% Obviously, color separation is a special case of masking by the vectors $(1,0,0,0)$, $(0,1,0,0)$, etc.
% An interesting application is to shade or tint all colors by masking them with $(x,x,x)$ in the \Model{rgb} or \Model{cmy} model, see the last two rows in figure \vref{fig.mask}.
%
% \medskip
%
% \DescribeMacro\maskcolors
%   \oarg{num model}\marg{color}\\
% Initialises all necessary parameters for color masking:
% if \Meta{num model} is not specified (or empty), \Meta{m-model} will be set to the natural model of \Meta{color}, otherwise to \Meta{num model};
% the color specification of \Meta{color} is extracted to define \Meta{m-spec}.
% Additionally, |\maskcolorstrue| is performed.
% \DescribeMacro\ifmaskcolors
% Color masking can be switched off temporarily by |\maskcolorsfalse|, or --- in a more radical way --- by |\maskcolors{}|, which in addition clears the initialisation parameters.
% \DescribeMacro\xglobal
% In general, the scope of |\maskcolors| is the current group (unless it is prefixed by the |\xglobal| command), but it may be used in the document preamble as well.
% The final remark of the color blending section applies here similarly.
%
% Now it is easy to separate a complete document without touching the source code:
% |latex| |\def\xcolorcmd{\maskcolors[cmyk]{cyan}}\input{a}| will do the \Color{cyan} part of the job for |a.tex|.
%
% \DescribeMacro\colormask
% Caution: \XC{} has no idea about colors in files that are included via the command |\includegraphics|, e.g., images of type \File{.eps}, \File{.pdf}, \File{.jpg}, or \File{.png}.
% Such files have to be separated separately.
% Nevertheless, \XC{} offers some basic support by storing the mask color in |\colormask|, which can be used to decide which file is to be included:
% \begin{verbatim}
% \def\temp{cyan}\ifx\colormask\temp \includegraphics{foo_c}\else
% \def\temp{magenta}\ifx\colormask\temp \includegraphics{foo_m}\else
% ...
% \fi\fi
% \end{verbatim}
%
%
%
% \subsection{Color series}\label{sec.series}
%
% Automatic coloring may be useful in graphics or chart applications, where a --- potentially large and unspecified --- number of colors are needed, and the user does not want or is not able to specify each individual color.
% Therefore, we introduce the term \emph{color series}, which consists of a base color and a scheme, how the next color is being constructed from the current color.
%
% The practical application consists of three parts:
% definition of a color series (usually once in the document), initialisation of the series (potentially several times), and application --- with or without stepping --- of the current color of the series (potentially many times).
%
%
% \subsubsection{Definition of a color series}
%
% \DescribeMacro\definecolorseries
%   \marg{name}\marg{core model}\marg{method}\oarg{b-model}\marg{b-spec}\oarg{s-model}\marg{s-spec}\\
% Defines a color series called \Meta{name}, whose calculations are performed within the color model \Meta{core model}, where \Meta{method} selects the algorithm (one of |step|, |grad|, |last|, see below).
% The method details are determined by the remaining arguments:
% \begin{itemize}
% \item \oarg{b-model}\marg{b-spec} specifies the \emph{base} (= first) color in the algorithm, either directly, e.g., |[rgb]{1,0.5,0.5}|, or as a \Meta{color}, e.g., |{-yellow!50}|, if the optional argument is missing.
% \item \oarg{s-model}\marg{s-spec} specifies how the \emph{step} vector is calculated in the algorithm, according to the chosen \Meta{method}:
%   \begin{itemize}
%   \item |step|,\ |grad|:\ the optional argument is meaningless, and \Meta{s-spec} is a parameter vector whose dimension is determined by \Meta{core model}, e.g., |{0.1,-0.2,0.3}| in case of |rgb|, |cmy|, or |hsb|.
%   \item |last|:\ the last color is specified either directly, e.g., |[rgb]{1,0.5,0.5}|, or as a \Meta{color}, e.g., |{-yellow!50}|, if the optional argument is missing.
%   \end{itemize}
% \end{itemize}
% This is the general scheme:
% \begin{gather}
% \emph{color}_1 := \emph{base},\qquad
% \emph{color}_{n+1} := U\bigl(\emph{color}_{n} + \emph{step}\bigr)
% \end{gather}
% for $n=1,2,\dots$, where $U$ maps arbitrary real $m$-vectors into the unit $m$-cube:
% \begin{gather}
% U(x_1,\dots,x_m) = (u(x_1),\dots,u(x_m)),\qquad
% u(x) =
% \begin{cases}
%  1 & \text{if $x=1$}\\
%  x-[x]& \text{if $x\neq1$}\\
% \end{cases}\label{eq.U}
% \end{gather}
% Thus, every step of the algorithm yields a valid color with parameters from the interval $[0,1]$.
%
% \medskip
% Now, the different methods use different schemes to calculate the \emph{step} vector:
% \begin{itemize}
% \item |step|,\ |grad|:\ the last argument, \marg{s-spec}, defines the directional vector \emph{grad}.
% \item |last|:\ \marg{s-spec} resp.\ \oarg{s-model}\marg{s-spec} defines the color parameter vector \emph{last}.
% \end{itemize}
% Then, during |\resetcolorseries|, the actual \emph{step} vector is calculated:
% \begin{gather}
% \emph{step} :=
% \begin{cases}
% \emph{grad} & \text{if $\Meta{method} = |step|$}\\
% \frac1{\Meta{div}}\cdot\emph{grad} & \text{if $\Meta{method} = |grad|$}\\
% \frac1{\Meta{div}}\cdot(\emph{last}-\emph{base}) & \text{if $\Meta{method} = |last|$}\\
% \end{cases}\label{eq.cs}
% \end{gather}
% Please note that it is also possible to use the current color placeholder `.' within the definition of color series.
% Thus, |\definecolorseries{foo}{rgb}{last}{.}{-.}| will set up a series that starts with the current color and ends with its complement.
% Of course, similar to \TeX's |\let| primitive, the \emph{current} definition of the current color at the time of execution is used, there is no relation to current colors in any later stage of the document.
%
%
% \subsubsection{Initialisation of a color series}
%
% \DescribeMacro\resetcolorseries
%   \oarg{div}\marg{name}\\
% This command has to be applied at least once, in order to make use of the color series \Meta{name}.
% It resets the current color of the series to the base color and calculates the actual step vector according to the chosen \Meta{div}, a non-zero real number, for the methods |grad| and |last|, see equation (\ref{eq.cs}).
% \DescribeMacro\colorseriescycle
% If the optional argument is empty, the value stored in the macro |\colorseriescycle| is applied.
% Its default value is \colorseriescycle, which can be changed by |\def\colorseriescycle|\marg{div}, applied \emph{before} the \XCP{} is loaded (similar to |\rangeRGB| and friends).
% The optional argument is ignored in case of the |step| method.
%
%
% \subsubsection{Application of a color series}
%
% There are two ways to display the current color of a color series:
% any of the \emph{color expressions} in section \vref{sec.term} used within a |\color|, |\textcolor|, \dots{} command will display this color according to the usual syntax of such expressions.
% However, in the cases when \Meta{postfix} equals `|!!+|', |\color{|\Meta{name}|!!+}| etc., will not only display the color, but it will also perform a step operation.
% Thus, the current color of the series will be changed in that case.
% An expression |\color{|\Meta{name}|!![|\Meta{num}|]}| enables direct access to an element of a series, where \Meta{num} = $0,1,2,\dots$, starting with~0 for the base color.
% See figure \vref{fig.csx} for a demonstration of different methods.
%
%
% \subsubsection{Differences between colors and color series}
%
% Although they behave similar if applied within color expressions, the objects defined by |\definecolor| and |\definecolorseries| are fundamentally different with respect to their scope/availability:
% like \LC's original |\definecolor| command, |\definecolor| generates \emph{local} colors, whereas |\definecolorseries| generates \emph{global} objects (otherwise it would not be possible to use the stepping mechanism within tables or graphics conveniently).
% E.g., if we assume that |bar| is an undefined color, then after saying
% \begin{verbatim}
% \begingroup
% \definecolorseries{foo}{rgb}{last}{red}{blue}
% \resetcolorseries[10]{foo}
% \definecolor{bar}{rgb}{.6,.5,.4}
% \endgroup
% \end{verbatim}
% commands like |\color{foo}| or |\color{foo!!+}| may be used without restrictions, whereas |\color{bar}| will give an error message.
% However, it is possible to say |\colorlet{bar}{foo}| or |\colorlet{bar}{foo!!+}| in order to save the current color of a series locally --- with or without stepping.
%
%
%
%
% \subsection{Border colors for hyperlinks}\label{sec.hyperref}
%
% The \Package{hyperref} package offers all kinds of support for hyperlinks, pdfmarks etc.
% There are two standard ways to make hyperlinks visible (see the package documentation \cite{hyperref} for additional information on how to set up these features):
% \begin{itemize}
% \item print hyperlinks in a different color than normal text, using the keys \Key{citecolor}, \Key{filecolor}, \Key{linkcolor}, \Key{menucolor}, \Key{pagecolor}, \Key{runcolor}, \Key{urlcolor} with color expressions, e.g., |\hypersetup{urlcolor=-green!50}|;
% \item display a colored border around hyperlinks, using the keys \Key{citebordercolor}, \Key{filebordercolor}, \Key{linkbordercolor}, \Key{menubordercolor}, \Key{pagebordercolor}, \Key{runbordercolor}, \Key{urlbordercolor} with explicit numerical \Model{rgb} parameter specification, e.g., |\hypersetup{urlbordercolor={1 0.5 0.25}}|.
% \end{itemize}
% Obviously, the second method is somewhat inconvenient since it does not allow for color names or even color expressions.
% Therefore, \XC{} provides --- via the package option \Option{hyperref} --- a set of extended keys \Key{xcitebordercolor}, \Key{xfilebordercolor}, \Key{xlinkbordercolor}, \Key{xmenubordercolor}, \Key{xpagebordercolor}, \Key{xrunbordercolor}, \Key{xurlbordercolor} which are being used in conjunction with color expressions, e.g., |\hypersetup{xurlbordercolor=-green!50}|.
%
% Another new key, \Key{xpdfborder}, provides a way to deal with a \Program{dvips}-related problem:
% for most of the drivers, a setting like |pdfborder={0 0 1}| will determine the width of the border that is drawn around hyperlinks in points.
% However, in the \Program{dvips} case, the numerical parameters are interpreted in relation to the chosen output resolution for processing the \File{.dvi} file into a \File{.ps} file.
% Unfortunately, at the time when the \File{.dvi} is constructed, nobody knows if and at which resolution a transformation into \File{.ps} will take place afterwards.
% Consequently, any default value for \Key{pdfborder} may be useful or not.
% Within \Package{hyperref}, the default for \Program{dvips} is |pdfborder={0 0 12}|, which works fine for a resolution of 600 or 1200 dpi, but which produces an invisible border for a resolution of 8000 dpi, as determined by the command-line switch |-Ppdf|.
% On the other hand, setting |pdfborder={0 0 80}| works fine for \Program{dvips} at 8000 dpi, but makes a document unportable, since other drivers (or even |dvips| in a low resolution) will draw very thick boxes in that case.
% This is were the \Key{xpdfborder} key comes in handy: it rescales its arguments for the |dvips| case by a factor 80 (ready for 8000 dpi) and leaves everything unchanged for other drivers.
% Thus one can say |xpdfborder={0 0 1}| in a driver-independent way.
%
%
%
% \subsection{Additional color specification in the \Package{pstricks} world}\label{sec.pstricks}
%
% For \Package{pstricks} users, there are different ways of invoking colors within command option keys:
% \begin{itemize}
% \item |\psset{linecolor=green!50}|
% \item |\psset{linecolor=[rgb]{0.5,1,0.5}}|
% \item |\psframebox[linecolor={[rgb]{0.5,1,0.5}}]{foo}|
% \end{itemize}
% Note the additional curly braces in the last case; without them, the optional argument of |\psframebox| would be terminated too early.
%
% \DescribeMacro\definecolor
%   |[ps]|\marg{name}\marg{core model-list}\marg{code}\\
% Stores \Index{PostScript} \Meta{code} --- that should not contain slash~`|/|' characters --- within a color.
% Example:
% after |\definecolor[ps]{foo}{rgb}{bar}|, the \Package{pstricks} command |\psline[linecolor=foo]...| inserts `|bar setrgbcolor|' where the linecolor information is required --- at least in case of the \Option{dvips} driver.
% See also \href{xcolor2.pdf}{\File{xcolor2.tex}} for an illustrative application.
%
%
%
% \subsection{Color in tables}
%
% \DescribeMacro\rowcolors
%   \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\
% \DescribeMacro{\rowcolors*}
%   \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\
% One of these commands has to be executed \emph{before} a table starts.
% \Meta{row} tells the number of the first row which should be colored according to the \Meta{odd-row color} and \Meta{even-row color} scheme.
% Each of the color arguments may also be left empty (= no color).
% In the starred version, \Meta{commands} are ignored in rows with inactive \emph{rowcolors status} (see below), whereas in the non-starred version, \Meta{commands} are applied to every row of the table.
% Such optional commands may be |\hline| or |\noalign|\marg{stuff}.
%
% \DescribeMacro\showrowcolors
% \DescribeMacro\hiderowcolors
% The \emph{rowcolors status} is activated (i.e., use coloring scheme) by default and/or |\showrowcolors|, it is inactivated (i.e., ignore coloring scheme) by the command |\hiderowcolors|.
% \DescribeMacro\rownum
% The counter |\rownum| may be used within such a table to access the current row number.
% An example is given in figure \vref{fig.row}.
% These commands require the \Option{table} option (which loads the \Package{colortbl} package).
%
% Note that table coloring may be combined with color series.
% This method was used to construct the examples in figure \vref{fig.csx}.
%
%
%
% \subsection{Color information}\label{sec.info}
%
% \DescribeMacro\extractcolorspec
%   \marg{color}\marg{cmd}\\
% Extracts the color specification of \Meta{color} and puts it into \Meta{cmd}; equivalent to |\def\cmd{|\marg{model}\marg{spec}|}|.
%
% \DescribeMacro\extractcolorspecs
%   \marg{color}\marg{model-cmd}\marg{color-cmd}\\
% Extracts the color specification of \Meta{color} and puts it into \Meta{model-cmd} and \Meta{color-cmd}, respectively.
%
% \medskip
% \DescribeMacro\tracingcolors
%   |=|\Meta{int}\\
% Controls the amount of information that is written into the |log| file:
% \begin{itemize}
% \item \mbox{$\Meta{int}\le0$:}~no specific color logging.
% \item \mbox{$\Meta{int}\ge1$:}~ignored color definitions due to |\providecolor| are logged.
% \item \mbox{$\Meta{int}\ge2$:}~multiple (i.e.~overwritten) color definitions are logged.
% \item \mbox{$\Meta{int}\ge3$:}~every command that defines a color will be logged.
% \item \mbox{$\Meta{int}\ge4$:}~every command that sets a color will be logged.
% \end{itemize}
% Like \TeX's |\tracing...| commands, this command may be used globally (in the document preamble) or locally/block-wise.
% The package sets |\tracingcolors=0| as default.
% Remark: since registers are limited and valuable, no counter is wasted for this issue.
%
% Note that whenever a color is used that has been defined via \LC's |\definecolor| command rather than \XC's new |\definecolor| and friends, a warning message `Incompatible color definition' will be issued.\footnote{This should not happen since usually there is no reason to load \LC{} in parallel to \XC{}.}
%
%
%
% \subsection{Color conversion}
%
% \DescribeMacro\convertcolorspec
%   \marg{model}\marg{spec}\marg{target model}\marg{cmd}\\
% Converts a color, given by the \Meta{spec} in model \Meta{model}, into \Meta{target model} and stores the new color specification in |\cmd|.
% \Meta{target model} must be of type \Meta{num model}, whereas \Meta{model} may also be `named', in which case \Meta{spec} is simply the name of the color.
%
% Example: |\convertcolorspec{cmyk}{0.81,1,0,0.07}{HTML}\tmp| acts like |\def| |\tmp{1F00ED}|.
%
%
%
% \subsection{Problems and solutions}
%
% \subsubsection{Name clashs between \Option{dvipsnames} and \Option{svgnames}}\label{sec.clash}
%
% Due to the fixed option processing order (which does not depend on the order how the options were specified in the |\usepackage| command), the \Option{svgnames} colors will always overrule \Option{dvipsnames} colors with identical names.
% This can lead to undesired results if both options are used together.
% For instance, \Color{Fuchsia} yields \testclr[cmyk]{0.47,0.91,0,0.08} under the regime of \Option{dvipsnames} and \testclr[rgb]{1,0,1} with respect to \Option{svgnames}.
% However, there is a simple trick --- based on \emph{deferred color definition} --- that allows us to use colors from both sets in the desired way:
% \begin{verbatim}
% \usepackage[dvipsnames*,svgnames]{xcolor}
% \definecolors{Fuchsia}
% \end{verbatim}
% Now all colors from the \Index{SVG} set are available (except \Color{Fuchsia}) plus \Color{Fuchsia} from the other set.
%
% \subsubsection{Page breaks and pdf\TeX}\label{sec.fixpdftex}
%
% Since pdf\TeX{} does not maintain a \emph{\Index{color stack}} --- in contrast to \Program{dvips} --- a typical problem is the behaviour of colors in the case of page breaks, as illustrated by the following example:
% \begin{verbatim}
% \documentclass{minimal}
% \usepackage{xcolor}
% \begin{document}
% black\color{red}red1\newpage red2\color{black}black
% \end{document}
% \end{verbatim}
% This works as expected with |dvips|, i.e., `red1' and `red2' being \Color{red}, however, with |pdftex|, `red2' is displayed in \Color{black}.
% The problem may be solved by using the \Option{fixpdftex} option which simply loads Heiko Oberdiek's \Package{pdfcolmk} package \cite{pdfcolmk}.
% However, its author also lists some limitations:
% \begin{itemize}
% \item Mark limitations: page breaks in math.
% \item LaTeX's output routine is redefinded.
% \begin{itemize}
% \item Changes in the output routine of newer versions of LaTeX are not detected.
% \item Packages that change the output routine are not supported.
% \end{itemize}
% \item It does not support several independent text streams like footnotes.
% \end{itemize}
%
% \subsubsection{Change color of included \File{.eps} file}\label{sec.fixinclude}
%
% In general, \XC{} cannot change colors of an image that is being included via the |\includegraphics| command from the \Package{graphics} or \Package{graphicx} package.
% There is, however, a limited opportunity to influence the current color of included \Index{PostScript} files.
% Consider the following file |foo.eps| which draws a framed gray box:
% \begin{verbatim}
% %!PS-Adobe-3.0 EPSF-3.0
% %%BoundingBox: 0 0 60 12
% 0 0 60 12 rectfill
% 0.75 setgray
% 2 2 56 8 rectfill
% \end{verbatim}
% Now run the following code through \LaTeX{} and \Program{dvips}:
% \begin{verbatim}
% \documentclass{minimal}
% \usepackage[fixinclude]{xcolor}
% \usepackage{graphics}
% \begin{document}
% \includegraphics{foo} \textcolor{red}{\includegraphics{foo}}
% \end{document}
% \end{verbatim}
% The resulting \File{.ps} file will display two gray boxes: the first with a black frame, the second with a red frame.
% If we had omitted the \Option{fixinclude} option, the second box would also display a black frame.
% This is because \Program{dvips} usually resets the current color to black immediately before including an \File{.eps} file.
%
%
%
%
% \clearpage
% \begin{adjustwidth}{-2.5cm}{}
% \section{Examples}
%
%
% \begin{figure}[htbp]\caption{Color spectrum}\label{fig.spectrum}
% \small
% \newcount\WL \unitlength.75pt
% \begin{picture}(460,60)(355,-10)
% \sffamily \tiny \linethickness{1.25\unitlength} \WL=360
% \multiput(360,0)(1,0){456}%
%  {{\color[wave]{\the\WL}\line(0,1){50}}\global\advance\WL1}
% \linethickness{0.25\unitlength}\WL=360
% \multiput(360,0)(20,0){23}%
%  {\picture(0,0)
%   \line(0,-1){5} \multiput(5,0)(5,0){3}{\line(0,-1){2.5}}
%   \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
%   \endpicture}
% \end{picture}
% \vspace*{3ex}
% \begin{verbatim}
% \newcount\WL \unitlength.75pt
% \begin{picture}(460,60)(355,-10)
% \sffamily \tiny \linethickness{1.25\unitlength} \WL=360
% \multiput(360,0)(1,0){456}%
%  {{\color[wave]{\the\WL}\line(0,1){50}}\global\advance\WL1}
% \linethickness{0.25\unitlength}\WL=360
% \multiput(360,0)(20,0){23}%
%  {\picture(0,0)
%   \line(0,-1){5} \multiput(5,0)(5,0){3}{\line(0,-1){2.5}}
%   \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
%   \endpicture}
% \end{picture}
% \end{verbatim}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Color testing}\label{fig.testcolors}
% \small
% \begin{adjustwidth}{-2.5cm}{}
% \raggedleft
% \sffamily
% \begin{testcolors}[rgb,cmyk,hsb,HTML,gray]
% \testcolor{olive}
% \testcolor{red!50!green}
% \testcolor{-cyan!50!magenta}
% \testcolor[cmyk]{0,0,1,0.5}
% \testcolor[cmyk]{0,0,.5,.5}
% \testcolor[rgb:cmyk]{0,0,.5,.5}
% \end{testcolors}
% \end{adjustwidth}
% \vspace*{3ex}
% \begin{adjustwidth}{2.5cm}{}
% \begin{verbatim}
% \sffamily
% \begin{testcolors}[rgb,cmyk,hsb,HTML,gray]
% \testcolor{olive}
% \testcolor{red!50!green}
% \testcolor{-cyan!50!magenta}
% \testcolor[cmyk]{0,0,1,0.5}
% \testcolor[cmyk]{0,0,.5,.5}
% \testcolor[rgb:cmyk]{0,0,.5,.5}
% \end{testcolors}
% \end{verbatim}
% \end{adjustwidth}
% \end{figure}
%
%
% \def\ukColor{MyGreen}
% \definecolor{\ukColor}{cmyk}{0.92,0,0.87,0.09}
% \colorlet{\ukColor-rgb}[rgb]{\ukColor}
% \colorlet{\ukColor-cmy}[cmy]{\ukColor}
% \colorlet{\ukColor-hsb}[hsb]{\ukColor}
% \colorlet{\ukColor-gray}[gray]{\ukColor}
%
% \begin{figure}[htbp]\caption{Progressing from one to another color}\label{fig.progress}
% \small
% \begin{adjustwidth}{-2.5cm}{}
% \makeatletter
% \def\ColorLoop#1#2{\@tfor\@@tmp:={}{-rgb}{-cmy}{-hsb}{-gray}\do
%   {\ifcase#1
%    \expandafter\Colorloop\expandafter{\expandafter\ukColor\@@tmp}{#2}\or
%    \expandafter\Colorshow\expandafter{\expandafter\ukColor\@@tmp}\fi}\\[-2ex]\ignorespaces}
% \def\Colorloop#1#2{\@ifxempty{#1}{}{\texttt{#1!}}&
%   \count@105 \@whilenum\count@>\z@\do
%    {\advance\count@-5
%     \@ifxempty{#1}{\hb@xt@\XCdim{\hss\textsf{\the\count@}\hss}}{\testclr{#1!\the\count@!#2}}\hskip-\fboxrule}\hskip\fboxrule&
%   \@ifxempty{#1}{}{\texttt{!#2}}\\}
% \def\Colorshow#1{\texttt{#1}&
%   \multicolumn2{l@{}}{\expandafter\let\expandafter\@@tmp\csname\string\color@#1\endcsname
%   \edef\@@tmp{\expandafter\@gobbletwo\@@tmp}\Meaning{@@tmp}}\\}
% \makeatother
% \sbox0{\testclr{red}}\XCdim\wd0
% \begin{tabular}{@{}lll@{}}
% \Colorloop{}{}\\[-2ex]
% \ColorLoop0{white}
% \ColorLoop0{gray}
% \ColorLoop0{black}
% \ColorLoop0{red}
% \ColorLoop0{blue}
% \ColorLoop0{yellow}
% \\\noalign{\vspace*{-2.5ex}}\hline\noalign{\vspace*{1.5ex}}
% \itshape Color&\itshape Definition/representation (\textup{\Option{\csname XC@@drv\endcsname}} driver)\\
% \ColorLoop1{}
% \end{tabular}
% \end{adjustwidth}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Target color model}\label{fig.tgt}
% \small
% \begin{adjustwidth}{-2.5cm}{}
% \raggedleft
% \extrarowheight2pt
% \makeatletter
% \def\X#1%
%  {\def\tmp{{#1}}\dots\Meaning{tmp}&
%   \selectcolormodel{#1}\testclr{red} \testclr{green} \testclr{blue} \testclr{cyan} \testclr{magenta} \testclr{yellow} \testclr{brown} \testclr{lime} \testclr{olive} \testclr{orange} \testclr{pink} \testclr{purple} \testclr{teal} \testclr{violet} \testclr{black} \testclr{darkgray} \testclr{gray} \testclr{lightgray} \testclr{white}\\}
% \makeatother
% \begin{tabular}{@{}>{\ttfamily}l@{ }l@{}}
% \string\selectcolormodel&\\
% \X{natural}
% \X{rgb}
% \X{cmy}
% \X{cmyk}
% \X{hsb}
% \X{gray}
% \end{tabular}
% \end{adjustwidth}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Standard color expressions}\label{fig.expr}
% \centering\small
% \def\test#1{\testclr{#1}& \texttt{#1}}
% \def\X#1{\test{#1}& \test{-#1}}
% \begin{tabular}{@{}l@{ \ }ll@{ \ }l@{}}
% \X{red}\\
% \X{red!75}\\
% \X{red!75!green}\\
% \X{red!75!green!50}\\
% \X{red!75!green!50!blue}\\
% \X{red!75!green!50!blue!25}\\
% \X{red!75!green!50!blue!25!gray}\\
% \end{tabular}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Standard color expressions}\label{fig.ex}
% \begin{minipage}{\textwidth}\small
% \begin{verbatim}
% \fboxrule6pt
% \fcolorbox
%  {red!70!green}% outer frame
%  {yellow!30!blue}% outer background
%  {\fcolorbox
%    {-yellow!30!blue}% inner frame
%    {-red!70!green}% inner background
%    {Test\textcolor{red!72.75}{Test}\color{-green}Test}}
% \end{verbatim}
% \end{minipage}\relax
% \llap{\fboxrule6pt \fcolorbox
%   {red!70!green}{yellow!30!blue}{\fcolorbox
%     {-yellow!30!blue}{-red!70!green}{Test\textcolor{red!72.75}{Test}\color{-green}Test}}}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Current color}\label{fig.cc}
% \begin{minipage}{\textwidth}\small
% \begin{verbatim}
% \def\test{current, \textcolor{.!50}{50\%},
%           \textcolor{-.}{complement},
%           \textcolor{yellow!50!.}{mix}}
% \textcolor{blue}{\test}\\
%  and \textcolor{red}{\test}\\
% \def\Test{\color{.!80}Test}
% \textcolor{blue}{\Test\Test\Test\Test\Test}\\
% and \textcolor{red}{\Test\Test\Test\Test\Test}
% \end{verbatim}
% \end{minipage}\relax
% \llap{\begin{minipage}{.5\textwidth}\small\raggedleft
% \def\test{current, \textcolor{.!50}{50\%},
%           \textcolor{-.}{complement},
%           \textcolor{yellow!50!.}{mix}}
% \textcolor{blue}{\test}\\
%  and \textcolor{red}{\test}\\
% \def\Test{\color{.!80}Test}
% \textcolor{blue}{\Test\Test\Test\Test\Test}\\
% and \textcolor{red}{\Test\Test\Test\Test\Test}
% \end{minipage}}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Color series}\label{fig.csx}
% \centering
% \def\tabulartest#1{\definecolorseries{test}#1\resetcolorseries[12]{test}%
%  \rowcolors[\hline]{1}{test!!+}{test!!+}%
%  \begin{tabular}{c}
%  \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
%  \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
%  \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
%  \number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\
%  \end{tabular}}
%
% \begin{tabular}{@{}*{9}{c}@{}}
% $S_1$ & $S_2$ & $G_1$ & $G_2$ & $L_1$ & $L_2$ & $L_3$ & $L_4$ & $L_5$ \\[3pt]
% \tabulartest{{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}}&
% \tabulartest{{hsb}{step}[hsb]{.575,1,1}{.11,-.05,0}}&
% \tabulartest{{rgb}{grad}[rgb]{.95,.85,.55}{3,11,17}}&
% \tabulartest{{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}}&
% \tabulartest{{rgb}{last}[rgb]{.95,.85,.55}[rgb]{.05,.15,.55}}&
% \tabulartest{{hsb}{last}[hsb]{.575,1,1}[hsb]{-.425,.15,1}}&
% \tabulartest{{rgb}{last}{yellow!50}{blue}}&
% \tabulartest{{hsb}{last}{yellow!50}{blue}}&
% \tabulartest{{cmy}{last}{yellow!50}{blue}}\\
% \end{tabular}
%
% \bigskip
%
% \footnotesize
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabular}{>{$}l<{$}l}
% \hline
% \multicolumn2{>{\columncolor{tableheadcolor}}c}{\em Individual definitions}\\
% S_1& |\definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}|\\
% S_2& |\definecolorseries{test}{hsb}{step}[hsb]{.575,1,1}{.11,-.05,0}|\\
% G_1& |\definecolorseries{test}{rgb}{grad}[rgb]{.95,.85,.55}{3,11,17}|\\
% G_2& |\definecolorseries{test}{hsb}{grad}[hsb]{.575,1,1}{.987,-.234,0}|\\
% L_1& |\definecolorseries{test}{rgb}{last}[rgb]{.95,.85,.55}[rgb]{.05,.15,.55}|\\
% L_2& |\definecolorseries{test}{hsb}{last}[hsb]{.575,1,1}[hsb]{-.425,.15,1}|\\
% L_3& |\definecolorseries{test}{rgb}{last}{yellow!50}{blue}|\\
% L_4& |\definecolorseries{test}{hsb}{last}{yellow!50}{blue}|\\
% L_5& |\definecolorseries{test}{cmy}{last}{yellow!50}{blue}|\\
% \hline
% \multicolumn2{>{\columncolor{tableheadcolor}}c}{\em Common definitions}\\
% \hiderowcolors
% &|\resetcolorseries[12]{test}|\\
% &|\rowcolors[\hline]{1}{test!!+}{test!!+}|\\
% &|\begin{tabular}{c}|\\
% &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
% &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
% &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
% &|\number\rownum\\ \number\rownum\\ \number\rownum\\ \number\rownum\\|\\
% &|\end{tabular}|\\
% \hline
% \end{tabular}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Color masking}\label{fig.mask}
% \begin{adjustwidth}{-2.5cm}{}
% \small\raggedleft
% \extrarowheight2pt
% \makeatletter
% \def\X#1#2{\edef\tmp{\@ifxempty{#1}{}{[#1]}{#2}}\dots\Meaning{tmp}&
%   \maskcolors[#1]{#2}\testclr{red} \testclr{green} \testclr{blue} \testclr{cyan} \testclr{magenta} \testclr{yellow} \testclr{brown} \testclr{lime} \testclr{olive} \testclr{orange} \testclr{pink} \testclr{purple} \testclr{teal} \testclr{violet} \testclr{black} \testclr{darkgray} \testclr{gray} \testclr{lightgray} \testclr{white}\\}\relax
% \makeatother
% \begin{tabular}{@{}>{\ttfamily}l@{ }l@{}}
% \string\maskcolors&\\
% \hline
% \X{}{}
% \hline
% \X{cmyk}{cyan}
% \X{cmyk}{magenta}
% \X{cmyk}{yellow}
% \X{cmyk}{black}
% \hline
% \X{cmyk}{red}
% \X{cmyk}{green}
% \X{cmyk}{blue}
% \hline
% \X{rgb}{red}
% \X{rgb}{green}
% \X{rgb}{blue}
% \hline
% \X{hsb}{red}
% \X{hsb}{green}
% \X{hsb}{blue}
% \hline
% \X{rgb}{gray}
% \X{cmy}{gray}
% \end{tabular}
% \end{adjustwidth}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Alternating row colors in tables: \cmd\rowcolors{} vs. \cmd\rowcolors\texttt*}\label{fig.row}
% \centering
% \begin{minipage}{\textwidth}
% \begin{verbatim}
% \rowcolors[\hline]{3}{green!25}{yellow!50} \arrayrulecolor{red!75!gray}
% \begin{tabular}{ll}
% test & row \number\rownum\\
% test & row \number\rownum\\
% test & row \number\rownum\\
% test & row \number\rownum\\
% \arrayrulecolor{black}
% test & row \number\rownum\\
% test & row \number\rownum\\
% \rowcolor{blue!25}
% test & row \number\rownum\\
% test & row \number\rownum\\
% \hiderowcolors
% test & row \number\rownum\\
% test & row \number\rownum\\
% \showrowcolors
% test & row \number\rownum\\
% test & row \number\rownum\\
% \multicolumn{1}%
%  {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
% \end{tabular}
% \end{verbatim}
% \end{minipage}
% \hskip-.5\textwidth
% \rowcolors[\hline]{3}{green!25}{yellow!50} \arrayrulecolor{red!75!gray}
% \begin{tabular}{ll}
% test & row \number\rownum\\
% test & row \number\rownum\\
% test & row \number\rownum\\
% test & row \number\rownum\\
% \arrayrulecolor{black}
% test & row \number\rownum\\
% test & row \number\rownum\\
% \rowcolor{blue!25}
% test & row \number\rownum\\
% test & row \number\rownum\\
% \hiderowcolors
% test & row \number\rownum\\
% test & row \number\rownum\\
% \showrowcolors
% test & row \number\rownum\\
% test & row \number\rownum\\
% \multicolumn{1}%
%  {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
% \end{tabular}
% \qquad
% \rowcolors*[\hline]{3}{green!25}{yellow!50}\arrayrulecolor{red!75!gray}
% \begin{tabular}{ll}
% test & row \number\rownum\\
% test & row \number\rownum\\
% test & row \number\rownum\\
% test & row \number\rownum\\
% \arrayrulecolor{black}
% test & row \number\rownum\\
% test & row \number\rownum\\
% \rowcolor{blue!25}
% test & row \number\rownum\\
% test & row \number\rownum\\
% \hiderowcolors
% test & row \number\rownum\\
% test & row \number\rownum\\
% \showrowcolors
% test & row \number\rownum\\
% test & row \number\rownum\\
% \multicolumn{1}%
%  {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
% \end{tabular}
% \arrayrulecolor{black}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{\Model{Hsb} and \Model{tHsb}: \emph{hue\Circ} in $15^\circ$ steps}\label{fig.tHsb}
% \begin{adjustwidth}{-2.5cm}{}
% \footnotesize\sffamily\raggedleft
% \extrarowheight.5pt
% \begin{testcolors}[rgb,cmyk,hsb,Hsb,tHsb]
% \testcolor[Hsb]{0,1,1}
% \testcolor[Hsb]{15,1,1}
% \testcolor[Hsb]{30,1,1}
% \testcolor[Hsb]{45,1,1}
% \testcolor[Hsb]{60,1,1}
% \testcolor[Hsb]{75,1,1}
% \testcolor[Hsb]{90,1,1}
% \testcolor[Hsb]{105,1,1}
% \testcolor[Hsb]{120,1,1}
% \testcolor[Hsb]{135,1,1}
% \testcolor[Hsb]{150,1,1}
% \testcolor[Hsb]{165,1,1}
% \testcolor[Hsb]{180,1,1}
% \testcolor[Hsb]{195,1,1}
% \testcolor[Hsb]{210,1,1}
% \testcolor[Hsb]{225,1,1}
% \testcolor[Hsb]{240,1,1}
% \testcolor[Hsb]{255,1,1}
% \testcolor[Hsb]{270,1,1}
% \testcolor[Hsb]{285,1,1}
% \testcolor[Hsb]{300,1,1}
% \testcolor[Hsb]{315,1,1}
% \testcolor[Hsb]{330,1,1}
% \testcolor[Hsb]{345,1,1}
% \testcolor[Hsb]{360,1,1}
% \noalign{\medskip}
% \testcolor[tHsb]{0,1,1}
% \testcolor[tHsb]{15,1,1}
% \testcolor[tHsb]{30,1,1}
% \testcolor[tHsb]{45,1,1}
% \testcolor[tHsb]{60,1,1}
% \testcolor[tHsb]{75,1,1}
% \testcolor[tHsb]{90,1,1}
% \testcolor[tHsb]{105,1,1}
% \testcolor[tHsb]{120,1,1}
% \testcolor[tHsb]{135,1,1}
% \testcolor[tHsb]{150,1,1}
% \testcolor[tHsb]{165,1,1}
% \testcolor[tHsb]{180,1,1}
% \testcolor[tHsb]{195,1,1}
% \testcolor[tHsb]{210,1,1}
% \testcolor[tHsb]{225,1,1}
% \testcolor[tHsb]{240,1,1}
% \testcolor[tHsb]{255,1,1}
% \testcolor[tHsb]{270,1,1}
% \testcolor[tHsb]{285,1,1}
% \testcolor[tHsb]{300,1,1}
% \testcolor[tHsb]{315,1,1}
% \testcolor[tHsb]{330,1,1}
% \testcolor[tHsb]{345,1,1}
% \testcolor[tHsb]{360,1,1}
% \end{testcolors}
% \end{adjustwidth}
% \end{figure}
%
%
% \begin{figure}[htbp]\caption{Color harmony}\label{fig.harmony}
% \begin{adjustwidth}{-2.5cm}{}
% \small\sffamily\raggedleft
% \extrarowheight1.5pt
% \begin{testcolors}[rgb,cmyk,Hsb,tHsb]
% \noalign{\smallskip}
% \rlap{\em complementary colors (two-color harmony):}\\
% \testcolor{yellow>wheel,1,2}
% \testcolor{yellow}
% \testcolor{yellow>twheel,1,2}
% \noalign{\medskip}
% \rlap{\em color triad (three-color harmony):}\\
% \testcolor{yellow>wheel,2,3}
% \testcolor{yellow>wheel,1,3}
% \testcolor{yellow}
% \testcolor{yellow>twheel,1,3}
% \testcolor{yellow>twheel,2,3}
% \noalign{\medskip}
% \rlap{\em color tetrad (four-color harmony):}\\
% \testcolor{yellow>wheel,3,4}
% \testcolor{yellow>wheel,2,4}
% \testcolor{yellow>wheel,1,4}
% \testcolor{yellow}
% \testcolor{yellow>twheel,1,4}
% \testcolor{yellow>twheel,2,4}
% \testcolor{yellow>twheel,3,4}
% \noalign{\medskip}
% \rlap{\em split complementary colors:}\\
% \testcolor{yellow>wheel,7,12}
% \testcolor{yellow>wheel,5,12}
% \testcolor{yellow}
% \testcolor{yellow>twheel,5,12}
% \testcolor{yellow>twheel,7,12}
% \noalign{\medskip}
% \rlap{\em analogous (adjacent) colors:}\\
% \testcolor{yellow>wheel,11,12}
% \testcolor{yellow>wheel,10,12}
% \testcolor{yellow>wheel,2,12}
% \testcolor{yellow>wheel,1,12}
% \testcolor{yellow}
% \testcolor{yellow>twheel,1,12}
% \testcolor{yellow>twheel,2,12}
% \testcolor{yellow>twheel,10,12}
% \testcolor{yellow>twheel,11,12}
% \end{testcolors}
% \end{adjustwidth}
% \end{figure}
%
% \end{adjustwidth}
%
%
% \clearpage
%
% \begin{adjustwidth}{-2.5cm}{}
% \raggedcolumns\columnsep2.5em
%
% \section{Colors by Name}\label{sec.names}
%
% \begin{multicols}{5}[\subsection{Base colors (always available)}\label{sec.basenam}]
% \footnotesize\def\0#1{\Testclr{#1}{#1}}
% \0{black}
% \0{blue}
% \0{brown}
% \0{cyan}
% \0{darkgray}
% \0{gray}
% \0{green}
% \0{lightgray}
% \0{lime}
% \0{magenta}
% \0{olive}
% \0{orange}
% \0{pink}
% \0{purple}
% \0{red}
% \0{teal}
% \0{violet}
% \0{white}
% \0{yellow}
% \end{multicols}
%
%
% \begin{multicols}{5}[\subsection{Colors via \Option{dvipsnames} option}\label{sec.dvipsnam}]
% \footnotesize\def\0#1{\Testclr{#1}{#1}}
% \0{Apricot}
% \0{Aquamarine}
% \0{Bittersweet}
% \0{Black}
% \0{Blue}
% \0{BlueGreen}
% \0{BlueViolet}
% \0{BrickRed}
% \0{Brown}
% \0{BurntOrange}
% \0{CadetBlue}
% \0{CarnationPink}
% \0{Cerulean}
% \0{CornflowerBlue}
% \0{Cyan}
% \0{Dandelion}
% \0{DarkOrchid}
% \0{Emerald}
% \0{ForestGreen}
% \0{Fuchsia}
% \0{Goldenrod}
% \0{Gray}
% \0{Green}
% \0{GreenYellow}
% \0{JungleGreen}
% \0{Lavender}
% \0{LimeGreen}
% \0{Magenta}
% \0{Mahogany}
% \0{Maroon}
% \0{Melon}
% \0{MidnightBlue}
% \0{Mulberry}
% \0{NavyBlue}
% \0{OliveGreen}
% \0{Orange}
% \0{OrangeRed}
% \0{Orchid}
% \0{Peach}
% \0{Periwinkle}
% \0{PineGreen}
% \0{Plum}
% \0{ProcessBlue}
% \0{Purple}
% \0{RawSienna}
% \0{Red}
% \0{RedOrange}
% \0{RedViolet}
% \0{Rhodamine}
% \0{RoyalBlue}
% \0{RoyalPurple}
% \0{RubineRed}
% \0{Salmon}
% \0{SeaGreen}
% \0{Sepia}
% \0{SkyBlue}
% \0{SpringGreen}
% \0{Tan}
% \0{TealBlue}
% \0{Thistle}
% \0{Turquoise}
% \0{Violet}
% \0{VioletRed}
% \0{White}
% \0{WildStrawberry}
% \0{Yellow}
% \0{YellowGreen}
% \0{YellowOrange}
% \end{multicols}
%
%
% \makeatletter
% \def\ColorList#1#2#3#4{\begin{multicols}{#1}[\subsection{Colors via \Option{#2names} option}\label{sec.#2nam}]
%   \footnotesize
%   \def\preparecolorset
%    {\def\XC@@cmd[####1]####2####3####4{\definecolor[####1]{@test}{####3}{####4}#4{@test}{####2}}\@testopt{\XC@definecolorset}{}}
%   \edef\restore{\catcode`\noexpand\%\the\catcode`\%\relax}
%   \catcode`\%14\relax\input{#3nam.def}\restore
%   \end{multicols}}
% \makeatother
%
% \ColorList4{svg}{svg}\Testclr
% \medskip
% \begin{adjustwidth}{1cm}{1cm}
% \footnotesize\raggedright Duplicate colors:
% \Color[-]{Aqua} = \Color[-]{Cyan},
% \Color[-]{Fuchsia} = \Color[-]{Magenta};
% \Color[-]{Navy} = \Color[-]{NavyBlue};
% \Color[-]{Gray} = \Color[-]{Grey},
% \Color[-]{DarkGray} = \Color[-]{DarkGrey},
% \Color[-]{LightGray} = \Color[-]{LightGrey},
% \Color[-]{SlateGray} = \Color[-]{SlateGrey},
% \Color[-]{DarkSlateGray} = \Color[-]{DarkSlateGrey},
% \Color[-]{LightSlateGray} = \Color[-]{LightSlateGrey},
% \Color[-]{DimGray} = \Color[-]{DimGrey}.
% \par\smallskip
% \Index{HTML4} color keyword subset:
% \Color[-]{Aqua}, \Color[-]{Black}, \Color[-]{Blue}, \Color[-]{Fuchsia},
% \Color[-]{Gray}, \Color[-]{Green}, \Color[-]{Lime}, \Color[-]{Maroon},
% \Color[-]{Navy}, \Color[-]{Olive}, \Color[-]{Purple}, \Color[-]{Red},
% \Color[-]{Silver}, \Color[-]{Teal}, \Color[-]{White}, \Color[-]{Yellow}.
% \par\smallskip
% Colors taken from \Index{Unix}/\Index{X11}:
% \Color[-]{LightGoldenrod},
% \Color[-]{LightSlateBlue},
% \Color[-]{NavyBlue},
% \Color[-]{VioletRed}.
% \end{adjustwidth}
%
% \ColorList4{x11}{x11}\Testclr
% \medskip
% \begin{adjustwidth}{1cm}{1cm}
% \footnotesize\raggedright Duplicate colors:
% \Color[-]{Gray0} = \Color[-]{Grey0},
% \Color[-]{Green0} = \Color[-]{Green1}.
% \end{adjustwidth}
%
% \end{adjustwidth}
%
%
%
%
% \clearpage
% \section{Technical Supplement}
%
% \subsection{Color models supported by drivers}
%
% Since some of the drivers only pretend to support the \Model{hsb} model, we included some code to bypass this behaviour.
% The models actually added by \XC{} are shown in the log file.
% Table \vref{tab.drv} lists mainly the drivers that are part of current MiK\TeX{} \cite{mik} distributions and their color model support.
% Probably, other distributions behave similarly.
%
% \begin{table}[htbp]\caption{Drivers and color models}\label{tab.drv}
% \centering\small
% \extrarowheight1pt
% \tabcolsep3pt
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabular}{ll*{9}{c}}
% \rowcolor{tableheadcolor}
% \hline
% \em Driver&\em Version&\Model{rgb}&\Model{cmy}&\Model{cmyk}&\Model{hsb}&\Model{gray}&\Model{RGB}&\Model{HTML}&\Model{HSB}&\Model{Gray}\\
% \Option{dvipdf}&2015/12/30 v3.0k&d&n&d&n&d&i&n&n&n\\
% \Option{dvips}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
% \Option{dvipsone}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
% \Option{pctex32}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
% \Option{pctexps}&2015/12/30 v3.0k&d&n&d&d&d&i&n&n&n\\
% \hline
% \Option{pdftex}&2011/05/27 v0.06d&d&n&d&n&d&i&n&n&n\\
% \Option{luatex}&2016/01/23 v0.01b&d&n&d&n&d&i&n&n&n\\
% \hline
% \Option{dvipdfm}&1999/9/6 vx.x&d&n&d&n&d&i&n&n&n\\
% \Option{dvipdfmx}&2016/04/06 v4.08&d&n&d&?&d&i&n&n&n\\
% \hline
% \Option{textures}&1997/5/28 v0.3&d&n&d&?&i&n&n&n&n\\
% \hline
% \Option{vtex}&1999/01/14 v6.3&d&n&d&n&i&i&n&n&n\\
% \hline
% \Option{xetex}&2016/04/06 v4.08&d&n&d&d&d&i&n&n&n\\
% \hline
% \Option{tcidvi}&2015/12/30 v3.0k&i&n&i&n&i&d&n&n&n\\
% \Option{truetex}&2015/12/30 v3.0k&i&n&i&n&i&d&n&n&n\\
% \hline
% \Option{dviwin}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
% \Option{emtex}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
% \Option{pctexhp}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
% \Option{pctexwin}&2015/12/30 v3.0k&n&n&n&n&n&n&n&n&n\\
% \hline\hline
% \multicolumn{11}c{\Option{dviwindo} = \Option{dvipsone}; \Option{oztex} = \Option{dvips}; \Option{xdvi} = \Option{dvips} + \Option{monochrome}}\\
% \hline
% \multicolumn{11}c{Driver's color model support: d\,=\,direct, i\,=\,indirect, n\,=\,none}\\
% \hline
% \end{tabular}
% \end{table}
%
%
%
% \subsection{How \XC{} handles driver-specific color models}
%
% Although there is a variety of drivers that implement different approaches to color visualisation, they all have some features in common, as defined by the original \LCP.
% One of these features is that any color model `foo' requires a |\color@foo|\marg{cmd}\marg{spec} command in order to translate the `foo'-dependent color \Meta{spec} into some driver-specific code that is stored in \Meta{cmd}.
% Therefore, \XC{} in general detects driver-support for the `foo' model via the existence of |\color@foo|.
%
% By this mechanism, \XC{} can also change the behaviour of certain models without touching the driver file itself.
% A good example is the |\substitutecolormodel| command which is used during the package initialisation process to provide support for models that are not covered by the actual driver (like \Model{hsb} for \Option{pdftex}) or that have incorrect implementations (like \Model{hsb} for \Option{dvipdfm}).
%
%
% \subsection{Behind the scenes: internal color representation}
%
% Every definition of a color in order to access it by its name requires an internal representation of the color, i.e.~a macro that contains some bits of information required by the driver to display the color properly.
%
% \LC's |\definecolor{foo}{...}{...}| generates a command |\\color@foo|\footnote{The double backslash is intentional.} which contains the color definition in a driver-dependent way; therefore it is possible but non-trivial to access the color model and parameters afterwards (see the \Package{colorinfo} package \cite{colorinfo} for a solution).
%
% \LC's |\DefineNamedColor{named}{foo}{...}{...}| generates |\col@foo|\footnote{The single backslash is intentional.} which again contains some driver-dependent information.
% In this case, an additional |\\color@foo| will only be defined if the package option \Option{usecolors} is active.
%
% \XC's |\definecolor{foo}{...}{...}| generates\footnote{This was introduced in version 1.10; prior to that, a command \cs{\string\xcolor@foo} with a different syntax was generated.} a command |\\color@foo| as well, which combines the features of the former commands and contains both the driver-dependent and driver-independent information, thus making it possible to access the relevant parameters in a standardised way.
% Although it has now a different syntax, |\\color@foo| expands to the same expression as the original command.
% On the other hand, |\col@foo| commands are no longer needed and therefore not generated in the `named' case: \XC{} works with a single color data structure (as described).
%
% Table \vref{tab.internal} shows some examples for the two most prominent drivers.
% See also figure \vref{fig.progress} which displays the definitions with respect to the driver that was used to process this document.
%
%
% \begin{table}[htb]\caption{Driver-dependent internal color representation}\label{tab.internal}
% \centering\small
% \def\X{\hspace*{-.845\textwidth}\\}
% \extrarowheight1pt
% \tabcolsep8pt
% \begin{tabular}{l>{\color{blue}(}r<{)}l}
% \hline
% \multicolumn3{>{\columncolor{tableheadcolor}}l}{\Option{dvips} driver}\\
% \hline
% |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}| & \LC\\
% |->rgb .5 0 1.|\X
% \hline
% |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}|& \XC\\
% |->\xcolor@ {}{rgb 0.5 0 1}{rgb}{0.5,0,1}.|\X
% \hline
% |\col@Plum=macro:| & |\DefineNamedColor{Plum}{rgb}{.5,0,1}|& \LC\\
% |->\@nil .|\X
% |\\color@Plum=macro:| & with option \oOption{usenames}\\
% |-> Plum.|\X
% \hline
% |\\color@Plum=macro:| & |\definecolor[named]{Plum}{rgb}{.5,0,1}|& \XC\\
% |->\xcolor@ {named}{ Plum}{rgb}{0.5,0,1}.|\X
% \hline
% \multicolumn3{>{\columncolor{tableheadcolor}}l}{\Option{pdftex} driver}\\
% \hline
% |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}|& \LC\\
% |->.5 0 1 rg .5 0 1 RG.|\X
% \hline
% |\\color@Plum=macro:| & |\definecolor{Plum}{rgb}{.5,0,1}|& \XC\\
% |->\xcolor@ {}{0.5 0 1 rg 0.5 0 1 RG}{rgb}{0.5,0,1}.|\X
% \hline
% |\col@Plum=macro:| & |\DefineNamedColor{Plum}{rgb}{.5,0,1}|& \LC\\
% |->.5 0 1 rg .5 0 1 RG.|\X
% |\\color@Plum=macro:| & with option \oOption{usenames}\\
% |->.5 0 1 rg .5 0 1 RG.|\X
% \hline
% |\\color@Plum=macro:| & |\definecolor[named]{Plum}{rgb}{.5,0,1}|& \XC\\
% |->\xcolor@ {}{0.5 0 1 rg 0.5 0 1 RG}{rgb}{0.5,0,1}.|\X
% \hline
% \end{tabular}
% \end{table}
%
%
%
% \subsection{A remark on accuracy}
%
% Since the macros presented here require some computation, special efforts were made to ensure a maximum of accuracy for conversion and mixing formulas --- all within \TeX's limited numerical capabilities.\footnote{For example, applying the `transformation' \cs{dimen0=0.}\Meta{int}\texttt{pt} \cs{the\string\dimen0} to all 5-digit numbers \Meta{int} of the range 00000\dots 99999, exactly 34464 of these 100000 numbers don't survive unchanged. We are not talking about gobbled final zeros here \dots}
% We decided to develop and include a small set of commands to improve the quality of division and multiplication results, instead of loading one of the packages that provide multi-digit arithmetic and a lot more, like \Package{realcalc} or \Package{fp}.
% The marginal contribution of the latter packages seems not to justify their usage for our purposes.
% Thus, we stay within a sort of fixed-point arithmetic framework, providing at most 5~decimal digits via \TeX's dimension registers.
%
%
%
%
% \clearpage
% \section{The Formulas}
%
% \subsection{Color mixing}
%
% In general, we use linear interpolation for color mixing:
% \begin{align}
% \mix(C, C', p) = p \cdot C + (1-p) \cdot C'\label{eq.mix}
% \end{align}
% Note that there is a special situation in the \Model{hsb} case:
% if $\emph{saturation}=0$ then the color equals a gray color of level \emph{brightness}, independently of the \emph{hue} value.
% Therefore, to achieve smooth transitions of an arbitrary color to a specific gray (like white or black), we actually use the formulas
% \begin{align}
% \Op\tint{hsb}(C, p) &= p \cdot C + (1-p) \cdot \bigl(\emph{hue},0,1\bigr)\\
% \Op\shade{hsb}(C, p) &= p \cdot C + (1-p) \cdot \bigl(\emph{hue},0,0\bigr)\\
% \Op\tone{hsb}(C, p) &\textstyle= p \cdot C + (1-p) \cdot \bigl(\emph{hue},0,\frac12\bigr)
% \end{align}
% where $C=(\emph{hue},\emph{saturation},\emph{brightness})$.
%
% From equation (\ref{eq.mix}) and the way how color expressions are being interpreted, as described in section \vref{sec.term}, it is an easy proof by induction to verify that a color expression
% \begin{gather}
% C_0!P_1!C_1!P_2!\dots!P_n!C_n
% \end{gather}
% with $n\in\{0,1,2,\dots\}$, colors $C_0,C_1,\dots,C_n$, and percentages $P_1,\dots,P_n\in [0,100]$ will result in a parameter vector
% \begin{equation}
% \begin{split}
% C &= \sum_{\nu=0}^n \Biggl(\prod_{\mu=\nu+1}^n p_\mu \Biggr) (1-p_\nu)\cdot C_\nu\\
%   &= p_n\cdots p_1\cdot C_0\\
%   &\quad + p_n\cdots p_2(1-p_1)\cdot C_1\\
%   &\quad + p_n\cdots p_3(1-p_2)\cdot C_2\\
%   &\quad + \dots\\
%   &\quad + p_n(1-p_{n-1})\cdot C_{n-1}\\
%   &\quad + (1-p_n)\cdot C_n
% \end{split}
% \end{equation}
% where $p_0 := 0$ and $p_\nu := P_\nu/100$ for $\nu=1,\dots,n$.
% We note also a split formula:
% \begin{equation}
% \begin{split}
% C_0!P_1!C_1!\dots!P_{n+k}!C_{n+k}
%  &= p_{n+k}\cdots p_{n+1}\cdot C_0!P_1!C_1!\dots!P_n!C_n\\
%  &\quad - p_{n+k}\cdots p_{n+1}\cdot C_n\\
%  &\quad + C_n!P_{n+1}!C_{n+1}!\dots!P_{n+k}!C_{n+k}
% \end{split}
% \end{equation}
%
%
% \begin{table}[p]\caption{Color constants}\label{tab.const}
% \centering
% \extrarowheight2pt
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabular}{*4{c}}
% \hline
% \rowcolor{tableheadcolor}
% \emph{model/constant} &
%       \ttfamily white  &  \ttfamily black & \ttfamily gray\\[2pt]
% \Model{rgb}&  $(1,1,1)$   & $(0,0,0)$   & $(\frac12,\frac12,\frac12)$ \\[2pt]
% \Model{cmy}&  $(0,0,0)$   & $(1,1,1)$   & $(\frac12,\frac12,\frac12)$ \\[2pt]
% \Model{cmyk}& $(0,0,0,0)$ & $(0,0,0,1)$ & $(0,0,0,\frac12)$ \\[2pt]
% \Model{hsb}&  $(h,0,1)$   & $(h,0,0)$   & $(h,0,\frac12)$ \\[2pt]
% \Model{Hsb}&  $(h^\circ,0,1)$ & $(h^\circ,0,0)$ & $(h^\circ,0,\frac12)$ \\[2pt]
% \Model{tHsb}& $(h^\circ,0,1)$ & $(h^\circ,0,0)$ & $(h^\circ,0,\frac12)$ \\[2pt]
% \Model{gray}& $1$ & $0$ & $\frac12$ \\[2pt]
% \Model{RGB}&  $(L,L,L)$ & $(0,0,0)$ & $(\lfloor\frac {L+1}2\rfloor,\lfloor\frac {L+1}2\rfloor,\lfloor\frac {L+1}2\rfloor)$ \\[2pt]
% \Model{HTML}& \texttt{FFFFFF}& \texttt{000000}& \texttt{808080}\\[2pt]
% \Model{HSB}&  $(H,0,M)$ & $(H,0,0)$ & $(H,0,\lfloor\frac {M+1}2\rfloor)$ \\[2pt]
% \Model{Gray}& $N$ & $0$ & $\lfloor\frac {N+1}2\rfloor$ \\[2pt]
% \hline
% \end{tabular}
% \end{table}
%
%
% \begin{table}[p]\caption{Color conversion pairs}\label{tab.cnv}
% \begin{adjustwidth}{-2.5cm}{}
% \small\raggedleft
% \def\Em#1{\Model{#1}}
% \def\sp{\hbox to3em{\hfil$\ast$\hfil}}
% \def\id{\textrm{id}}
% \extrarowheight1pt
% \tabcolsep3pt
% \rowcolors{3}{tablerowcolor}{}
% \begin{tabular}{c*{11}{>{\sffamily}c}}
% \rowcolor{tableheadcolor}
% \hline
% \emph{from/to}&
%            \Em{rgb}& \Em{cmy}& \Em{cmyk}& \Em{hsb}& \Em{Hsb} & \Em{tHsb} & \Em{gray}& \Em{RGB}& \Em{HTML}& \Em{HSB}& \Em{Gray}\\
% \Em{rgb}&  \id     & \sp     & (cmy)    & \sp     & (hsb)    & (hsb)     & \sp      & \sp     & \sp      & (hsb)   & (gray)\\
% \Em{cmy}&  \sp     & \id     & \sp      & (rgb)   & (rgb)    & (rgb)     & \sp      & (rgb)   & (rgb)    & (rgb)   & (gray)\\
% \Em{cmyk}& (cmy)   & \sp     & \id      & (cmy)   & (cmy)    & (cmy)     & \sp      & (cmy)   & (cmy)    & (cmy)   & (gray)\\
% \Em{hsb}&  \sp     & (rgb)   & (rgb)    & \id     & \sp      & (Hsb)     & (rgb)    & (rgb)   & (rgb)    & \sp     & (rgb)\\
% \Em{Hsb}&  (hsb)   & (hsb)   & (hsb)    & \sp     & \id      & \sp       & (hsb)    & (hsb)   & (hsb)    & (hsb)   & (hsb)\\
% \Em{tHsb}& (Hsb)   & (Hsb)   & (Hsb)    & (Hsb)   & \sp      & \id       & (Hsb)    & (Hsb)   & (Hsb)    & (Hsb)   & (Hsb)\\
% \Em{gray}& \sp     & \sp     & \sp      & \sp     & \sp      & \sp       & \id      & \sp     & \sp      & \sp     & \sp\\
% \Em{RGB}&  \sp     & (rgb)   & (rgb)    & (rgb)   & (rgb)    & (rgb)     & (rgb)    & \id     & (rgb)    & (rgb)   & (rgb)\\
% \Em{HTML}& \sp     & (rgb)   & (rgb)    & (rgb)   & (rgb)    & (rgb)     & (rgb)    & (rgb)   & \id      & (rgb)   & (rgb)\\
% \Em{HSB}&  (hsb)   & (hsb)   & (hsb)    & \sp     & (hsb)    & (hsb)     & (hsb)    & (hsb)   & (hsb)    & \id     & (hsb)\\
% \Em{Gray}& (gray)  & (gray)  & (gray)   & (gray)  & (gray)   & (gray)    & \sp      & (gray)  & (gray)   & (gray)  & \id\\
% \Em{wave}& (hsb)   & (hsb)   & (hsb)    & \sp     & (hsb)    & (hsb)     & (hsb)    & (hsb)   & (hsb)    & (hsb)   & (hsb)\\
% \hline\hline
% \multicolumn{12}{c}{\id{} = identity function; $\ast$ = specific conversion function;}\\
% \multicolumn{12}{c}{\textsf{(model)} = conversion via specified model}\\
% \hline
% \end{tabular}
% \end{adjustwidth}
% \end{table}
%
%
%
% \subsection{Conversion between integer and real models}
%
% We fix a positive integer $n$ and define the sets $\mathcal I_n:=\{0,1,\dots,n\}$ and $\mathcal R:= [0,1]$.
% The complement of $\nu\in\mathcal I_n$ is $n-\nu$, the complement of $x\in\mathcal R$ is $1-x$.
%
% \subsubsection{Real to integer conversion}\label{sec.real2int}
%
% The straightforward mapping for this case is
% \begin{gather}
% \textstyle\RtoI n : \mathcal R \to \mathcal I_n,\ x \mapsto \rd(n\cdot x,0) = \left\lfloor \frac12+n\cdot x\right\rfloor
% \end{gather}
% where $\rd(r,d)$ rounds the real number $r$ to $d\ge0$ decimal digits.
% This mapping nearly always preserves complements, as shown in the next lemma.
% \begin{lemma}[Preservation of complements]
% For $x\in\mathcal R$,
% \begin{gather}
% \textstyle\RtoI n(x) + \RtoI n(1-x) = n \iff x \notin \mathcal R_n^\circ := \left\{ \frac1n\bigl(\nu - \frac12\bigr) \bigm\vert \nu=1,2,\dots,n\right\}.
% \end{gather}
% \end{lemma}
% \begin{proof}
% Let $\nu:=\RtoI n(x)$, then from $-\frac12 \le \eta := n\cdot x - \nu < \frac12$ we conclude
% \begin{gather*}
% \textstyle \RtoI n(1-x) = \rd(n(1-x),0) = \rd(n-\nu-\eta,0) =
% \begin{cases}
%  n-\nu   & \text{if $\eta\neq-\frac12$}\\
%  n-\nu+1 & \text{if $\eta=-\frac12$}
% \end{cases}
% \end{gather*}
% Now, $\eta = -\frac12 \iff x = \frac1n\bigl(\nu-\frac12\bigr) \iff x\in\mathcal I_n'$.
% \end{proof}
% Remark: the set $\mathcal R_n^\circ$ is obviously identical to the set of points where $\RtoI n$ is not continuous.
%
%
% \subsubsection{Integer to real conversion}\label{sec.int2real}
%
% The straightforward way in this case is the function
% \begin{gather}
% \ItoR n^*: \mathcal I_n \to \mathcal R,\ \nu \mapsto \frac \nu n.
% \end{gather}
% This is, however, only one out of a variety of solutions: every function $\ItoR n:\mathcal I_n\to\mathcal R$ that obeys the condition
% \begin{gather}
% \nu\in\mathcal I_n \Rightarrow \Gamma_n\bigl(\ItoR n(\nu)\bigr) = \nu
% \end{gather}
% which is equivalent to
% \begin{gather}
% \nu\in\mathcal I_n \Rightarrow \nu + \frac12 > n\cdot\ItoR n(\nu) \ge \nu - \frac12\label{eq.round}
% \end{gather}
% does at least guarantee that all integers $\nu$ may be reconstructed from $\ItoR n(\nu)$ via multiplication by $n$ and rounding to the nearest integer.
% Preservation of complements means now
% \begin{gather}
% \nu\in\mathcal I_n \Rightarrow \ItoR n(\nu) + \ItoR n(n-\nu) = 1
% \end{gather}
% which is obviously the case for $\ItoR n = \ItoR n^*$.
% If we consider, more generally, a transformation
% \begin{gather}
% \ItoR n(\nu) = \frac{\nu + \alpha}{n + \beta}
% \end{gather}
% with $\beta\neq-n$, then the magic inequality (\ref{eq.round}) is equivalent to
% \begin{gather}
% \frac12 > \frac{\alpha n - \beta\nu}{n + \beta} \ge -\frac12
% \end{gather}
% which is obeyed by the function
% \begin{gather}
% \ItoR n':\mathcal I_n\to\mathcal R,\ \nu \mapsto
% \begin{cases}
% \frac\nu{n+1}& \text{if $\nu\le\frac{n+1}2$}\\[0.25ex]
% \frac{\nu+1}{n+1}& \text{if $\nu>\frac{n+1}2$}
% \end{cases}
% \end{gather}
% that has the nice feature $\ItoR n'\bigl(\frac{n+1}2\bigr) = \frac12$ for odd $n$.
% \begin{lemma}[Preservation of complements]
% For odd $n$ and each $\nu\in\mathcal I_n$,
% \begin{gather}
% \textstyle\ItoR n'(\nu) + \ItoR n'(n-\nu) = 1 \iff \nu \notin \mathcal I_n^\circ := \left\{ \frac{n-1}2, \frac{n+1}2 \right\}.
% \end{gather}
% \end{lemma}
% \begin{proof}
% The assertion is a consequence of the following arguments:
% \begin{itemize}
% \item $\nu<\frac{n-1}2 \iff n-\nu>\frac{n+1}2$ \ and \ $\frac{n-1}2 + \frac{n+1}2 = n$;
% \item $\nu<\frac{n-1}2 \,\Rightarrow\, \ItoR n'(\nu) + \ItoR n'(n-\nu) = \frac\nu{n+1} + \frac{n-\nu+1}{n+1} = 1$;
% \item $\nu=\frac{n-1}2 \,\Rightarrow\, \ItoR n'(\nu) + \ItoR n'(n-\nu) = \frac{n-1}{2(n+1)} + \frac12 = \frac n{n+1} \neq1$.\qedhere
% \end{itemize}
% \end{proof}
%
% For the time being, we choose \fbox{$\ItoR n := \ItoR n^*$} as default transformation function.
%
% \medskip
% Another variant --- which is probably too slow for large-scale on-the-fly calculations --- may be used for constructing sets of predefined colors.
% The basic idea is to minimize the number of decimal digits in the representation while keeping some invariance with respect to the original resolution:
% \begin{gather}
% \textstyle\ItoR n'':\mathcal I_n\to\mathcal R,\ \nu \mapsto \rd\bigl(\frac\nu n, d_n(\frac\nu n)\bigr)
% \end{gather}
% where
% \begin{gather}
% d_n:[0,1]\to\bbbN,\ x \mapsto \min\bigl\{ d\in\bbbN \bigm\vert \RtoI n\bigl(\rd(\ItoR n^*(\RtoI n(x)),d)\bigr) = \RtoI n(x)\bigr\}
% \end{gather}
% In the most common case $n=255$ it turns out that we end up with at most 3 decimal digits; preservation of complements is only violated for $\nu\in\{25,26,76,77,127,128,178,179,229,230\}$ where the corresponding set of decimal numbers is $\{0.098,0.1,0.298,0.3,0.498,0.5,0.698,0.7,0.898,0.9\}$.
%
%
%
% \subsection{Color conversion and complements}\label{sec.cnv}
%
% We collect here the specific conversion formulas between the supported color models.
% Table \vref{tab.cnv} gives an overwiew of how each conversion pair is handled.
% In general, \Index{PostScript} (as described in \cite{plrm}) is used as a basis for most of the calculations, since it supports the color models \Model{rgb}, \Model{cmyk}, \Model{hsb}, and \Model{gray} natively.
% Furthermore, \People{Alvy Ray}{Smith}'s paper \cite{smith} is cited in \cite{plrm} as reference for \Model{hsb}-related formulas.
%
% First, we define a constant which is being used throughout the conversion formulas:
% \begin{gather}
% E := (1,1,1)
% \end{gather}
%
%
% \subsubsection{The \Model{rgb} model}
%
% \paragraph{Conversion \Model{rgb} to \Model{cmy}}\label{sec.rgb2cmy}
% Source: \cite{plrm}, p. 475.
% \begin{gather}
% (\emph{cyan}, \emph{magenta}, \emph{yellow}) := E-(\emph{red}, \emph{green}, \emph{blue})
% \end{gather}
%
%
% \paragraph{Conversion \Model{rgb} to \Model{hsb} (1)}
% We set
% \begin{align}
% x & := \max\{\emph{red}, \emph{green}, \emph{blue}\}\\
% y & := \med\{\emph{red}, \emph{green}, \emph{blue}\}\\
% z & := \min\{\emph{red}, \emph{green}, \emph{blue}\}%\\
% \end{align}
% where `$\med$' denotes the median of the values.
% Then,
% \begin{align}
% \emph{brightness} & := x\\
% \intertext{Case $x=z$:}
% \emph{saturation} & := 0\\
% \emph{hue} & := 0\\
% \intertext{Case $x\neq z$:}
% \emph{saturation} & := \frac{x - z}x\\
% f & := \frac{x - y}{x - z}
% \end{align}
% \begin{gather}
% \emph{hue} := \frac 16\cdot
%  \begin{cases}
%  1-f & \text{if $x=\emph{red}\ge\emph{green}\ge\emph{blue}=z$}\\
%  1+f & \text{if $x=\emph{green}\ge\emph{red}\ge\emph{blue}=z$}\\
%  3-f & \text{if $x=\emph{green}\ge\emph{blue}\ge\emph{red}=z$}\\
%  3+f & \text{if $x=\emph{blue}\ge\emph{green}\ge\emph{red}=z$}\\
%  5-f & \text{if $x=\emph{blue}\ge\emph{red}\ge\emph{green}=z$}\\
%  5+f & \text{if $x=\emph{red}\ge\emph{blue}>\emph{green}=z$}
%  \end{cases}\label{eq.rgb2hsb1}
% \end{gather}
%
% \medskip
%
% This is based on \cite{smith}, \emph{RGB to HSV Algorithm (Hexcone Model)}, which reads (slightly reformulated):
% \begin{gather}
% r := \frac{x - \emph{red}}{x - z},\qquad
% g := \frac{x - \emph{green}}{x - z},\qquad
% b := \frac{x - \emph{blue}}{x - z}\\
% \emph{hue} := \frac 16\cdot
%  \begin{cases}
%  5+b & \text{if $\emph{red}=x$ and $\emph{green}=z$}\\
%  1-g & \text{if $\emph{red}=x$ and $\emph{green}>z$}\\
%  1+r & \text{if $\emph{green}=x$ and $\emph{blue}=z$}\\
%  3-b & \text{if $\emph{green}=x$ and $\emph{blue}>z$}\\
%  3+g & \text{if $\emph{blue}=x$ and $\emph{red}=z$}\\
%  5-r & \text{if $\emph{blue}=x$ and $\emph{red}>z$}
%  \end{cases}
% \end{gather}
% Note that the singular case $x=z$ is not covered completely in Smith's original algorithm; we stick here to \Index{PostScript}'s behaviour in real life.
%
% Because we need to sort three numbers in order to calculate $x,y,z$, several comparisons are involved in the algorithm.
% We present now a second method which is more suited for \TeX.
%
%
% \paragraph{Conversion \Model{rgb} to \Model{hsb} (2)}
% Let $\beta$ be a function that takes a Boolean expression as argument and returns 1 if the expression is true, 0 otherwise; set
% \begin{gather}
% i := 4\cdot\beta(\emph{red}\ge\emph{green}) + 2\cdot\beta(\emph{green}\ge\emph{blue}) + \beta(\emph{blue}\ge\emph{red}),
% \intertext{and}
% (\emph{hue},\emph{saturation},\emph{brightness}) :=
% \begin{cases}
% \Phi(\emph{blue},\emph{green},\emph{red},3,1) & \text{if $i=1$}\\
% \Phi(\emph{green},\emph{red},\emph{blue},1,1) & \text{if $i=2$}\\
% \Phi(\emph{green},\emph{blue},\emph{red},3,-1) & \text{if $i=3$}\\
% \Phi(\emph{red},\emph{blue},\emph{green},5,1) & \text{if $i=4$}\\
% \Phi(\emph{blue},\emph{red},\emph{green},5,-1) & \text{if $i=5$}\\
% \Phi(\emph{red},\emph{green},\emph{blue},1,-1) & \text{if $i=6$}\\
% (0,0,\emph{blue}) &  \text{if $i=7$}
% \end{cases}\label{eq.rgb2hsb2}
% \intertext{where}
% \Phi(x,y,z,u,v) := \Bigl( \frac{u\cdot(x-z)+v\cdot(x-y)}{6(x-z)}, \frac{x-z}x, x\Bigr)
% \end{gather}
%
% The singular case $x=z$, which is equivalent to $\emph{red}=\emph{green}=\emph{blue}$, is covered here by $i=7$.
%
% \medskip
%
% It is not difficult to see that this algorithm is a reformulation of the previous method.
% The following table explains how the transition from equation (\ref{eq.rgb2hsb1}) to equation (\ref{eq.rgb2hsb2}) works:
%
% \medskip
%
% \begin{tabular*}{\textwidth}{@{\extracolsep\fill}*5{>{$}c<{$}}l@{}}
% 6\cdot\emph{hue}& \emph{Condition}& \emph{red}\ge\emph{green}& \emph{green}\ge\emph{blue}& \emph{blue}\ge\emph{red}& $i$\\\hline
%  1-f & \emph{red}\ge\emph{green}\ge\emph{blue}& 1& 1& *& \textbf6/7\\
%  1+f & \emph{green}\ge\emph{red}\ge\emph{blue}& *& 1& *& \textbf2/3/6/7\\
%  3-f & \emph{green}\ge\emph{blue}\ge\emph{red}& *& 1& 1& \textbf3/7\\
%  3+f & \emph{blue}\ge\emph{green}\ge\emph{red}& *& *& 1& \textbf1/3/5/7\\
%  5-f & \emph{blue}\ge\emph{red}\ge\emph{green}& 1& *& 1& \textbf5/7\\
%  5+f & \emph{red}\ge\emph{blue}\ge\emph{green}& 1& *& *& \textbf4/5/6/7\\
% \end{tabular*}
%
% \medskip
%
% Here, $*$ denotes possible 0 or 1 values.
% Bold $i$~values mark the main cases where all $*$~values of a row are zero.
% The slight difference to equation (\ref{eq.rgb2hsb1}) in the last inequality is intentional and does no harm.
%
%
% \paragraph{Conversion \Model{rgb} to \Model{gray}}
% Source: \cite{plrm}, p. 474.
% \begin{align}
% \emph{gray} & := 0.3\cdot\emph{red} + 0.59\cdot\emph{green} + 0.11\cdot\emph{blue}
% \end{align}
%
%
% \paragraph{Conversion \Model{rgb} to \Model{RGB}}
% As described in section \vref{sec.real2int}.
% \begin{gather}
% (\emph{Red},\emph{Green},\emph{Blue}) := \bigl(\RtoI L(\emph{red}), \RtoI L(\emph{green}), \RtoI L(\emph{blue})\bigr)
% \end{gather}
%
%
% \paragraph{Conversion \Model{rgb} to \Model{HTML}}
% As described in section \vref{sec.real2int}.
% Convert to 6-digit hexadecimal afterwards.
% Certainly, multiplication and summation can be replaced by simple text concatenation of 2-digit hexadecimals.
% \begin{gather}
% \emph{RRGGBB} := \bigl( 65536\cdot\RtoI L(\emph{red}) + 256\cdot \RtoI L(\emph{green}) + \RtoI L(\emph{blue}) \bigr)_{\emph{hex}}
% \end{gather}
%
%
% \paragraph{Complement of \Model{rgb} color}
% We simply take the complementary vector:
% \begin{gather}
% (\emph{red}^*, \emph{green}^*, \emph{blue}^*) := E - (\emph{red}, \emph{green}, \emph{blue})
% \end{gather}
%
%
% \subsubsection{The \Model{cmy} model}
%
% \paragraph{Conversion \Model{cmy} to \Model{rgb}}
% This is simply a reversion of the $\Model{rgb}\to\Model{cmy}$ case, cf. section \vref{sec.rgb2cmy}.
% \begin{gather}
% (\emph{red}, \emph{green}, \emph{blue}) := E - (\emph{cyan}, \emph{magenta}, \emph{yellow})
% \end{gather}
%
%
% \paragraph{Conversion \Model{cmy} to \Model{cmyk}}\label{sec.cmy2cmyk}
% This is probably the hardest of our conversion tasks: many sources emphasize that there does not exist any universal conversion algorithm for this case because of device-dependence.
% The following algorithm is an extended version of the one given in \cite{plrm}, p. 476.
% \begin{align}
% k & := \min\{\emph{cyan},\emph{magenta},\emph{yellow}\}\\
% \emph{cyan} & := \min\{1,\max\{0,\emph{cyan} - \emph{UCR}_c(k)\}\}\\
% \emph{magenta} & := \min\{1,\max\{0,\emph{magenta} - \emph{UCR}_m(k)\}\}\\
% \emph{yellow} & := \min\{1,\max\{0,\emph{yellow} - \emph{UCR}_y(k)\}\}\\
% \emph{black} & := \emph{BG}(k)
% \end{align}
% Here, four additional functions are required:
% \begin{align}
% \emph{UCR}_c, \emph{UCR}_m, \emph{UCR}_y & : [0,1] \to [-1,1]\tag*{\em undercolor-removal}\\
% \emph{BG} & : [0,1] \to [0,1]\tag*{\em black-generation}
% \end{align}
% These functions are device-dependent, see the remarks in \cite{plrm}.
% Although there are some indications that they should be chosen as nonlinear functions, as long as we have no further knowledge about the target device we define them linearly:
% \begin{align}
% \emph{UCR}_c(k) &:= \beta_c\cdot k\\
% \emph{UCR}_m(k) &:= \beta_m\cdot k\\
% \emph{UCR}_y(k) &:= \beta_y\cdot k\\
% \emph{BG}(k) &:= \beta_k\cdot k
% \end{align}
% \DescribeMacro\adjustUCRBG
% where the parameters are given by |\def\adjustUCRBG{|\Meta{$\beta_c$},\Meta{$\beta_m$},\Meta{$\beta_y$},\Meta{$\beta_k$}|}| at any point in a document, defaulting to |{|$\adjustUCRBG$|}|.
%
%
% \paragraph{Conversion \Model{cmy} to \Model{gray}}
% This is derived from the conversion chain $\Model{cmy}\to\Model{rgb}\to\Model{gray}$.
% \begin{align}
% \emph{gray} & := 1 - (0.3\cdot\emph{cyan} + 0.59\cdot\emph{magenta} + 0.11\cdot\emph{yellow})
% \end{align}
%
%
% \paragraph{Complement of \Model{cmy} color}
% We simply take the complementary vector:
% \begin{gather}
% (\emph{cyan}^*, \emph{magenta}^*, \emph{yellow}^*) := E - (\emph{cyan}, \emph{magenta}, \emph{yellow})
% \end{gather}
%
%
% \subsubsection{The \Model{cmyk} model}
%
% \paragraph{Conversion \Model{cmyk} to \Model{cmy}}\label{sec.cmyk2cmy}
% Based on \cite{plrm}, p. 477, in connection with $\Model{rgb}\to\Model{cmy}$ conversion.
% \begin{align}
% \emph{cyan} & := \min\{1,\emph{cyan} + \emph{black}\}\\
% \emph{magenta} & := \min\{1,\emph{magenta} + \emph{black}\}\\
% \emph{yellow} & := \min\{1,\emph{yellow} + \emph{black}\}
% \end{align}
%
%
% \paragraph{Conversion \Model{cmyk} to \Model{gray}}
% Source: \cite{plrm}, p. 475.
% \begin{align}
% \emph{gray} & := 1 - \min\{1,0.3\cdot\emph{cyan} + 0.59\cdot\emph{magenta} + 0.11\cdot\emph{yellow} + black\}
% \end{align}
%
%
% \paragraph{Complement of \Model{cmyk} color}
% The simple vector complement does not yield useful results.
% Therefore, we first convert %$C=(\emph{cyan}, \emph{magenta}, \emph{yellow}, \emph{black})$
% to the \Model{cmy} model, calculate the complement there, and convert back to \Model{cmyk}.
%
%
% \subsubsection{The \Model{hsb} model}
%
% \paragraph{Conversion \Model{hsb} to \Model{rgb}}
% \begin{gather}
% (\emph{red},\emph{green},\emph{blue}) :=
%  \emph{brightness}\cdot( E - \emph{saturation}\cdot F)\\
% \intertext{with}
% i := \left\lfloor 6\cdot\emph{hue}\right\rfloor,\qquad f := 6\cdot\emph{hue} - i\\
% \intertext{and}
% F :=
%  \begin{cases}
%   (0,1-f,1) & \text{if $i=0$}\\
%   (f,0,1) & \text{if $i=1$}\\
%   (1,0,1-f) & \text{if $i=2$}\\
%   (1,f,0) & \text{if $i=3$}\\
%   (1-f,1,0) & \text{if $i=4$}\\
%   (0,1,f) & \text{if $i=5$}\\
%   (0,1,1) & \text{if $i=6$}
%  \end{cases}\label{eq.hsb2rgb2}
% \end{gather}
%
% \medskip
%
% This is based on \cite{smith}, \emph{HSV to RGB Algorithm (Hexcone Model)}, which reads (slightly reformulated):
% \begin{align}
% m & := 1-\emph{saturation}\\
% n & := 1-f\cdot\emph{saturation}\\
% k & := 1-(1-f)\cdot\emph{saturation}\\
% (\emph{red},\emph{green},\emph{blue}) & := \emph{brightness}\cdot
%  \begin{cases}
%   (1,k,m) & \text{if $i=0,6$}\\
%   (n,1,m) & \text{if $i=1$}\\
%   (m,1,k) & \text{if $i=2$}\\
%   (m,n,1) & \text{if $i=3$}\\
%   (k,m,1) & \text{if $i=4$}\\
%   (1,m,n) & \text{if $i=5$}
%  \end{cases}\label{eq.hsb2rgb1}
% \end{align}
% Note that the case $i=6$ (which results from $\emph{hue}=1$) is missing in Smith's algorithm.
% Because of
% \begin{align}
% \lim_{f\to1} (0,1,f) = (0,1,1) = \lim_{f\to0} (0,1-f,1)
% \end{align}
% it is clear that there is only one way to define $F$ for $i=6$ in order to get a continuous function, as shown in equation (\ref{eq.hsb2rgb2}).
% This has been transformed back to equation (\ref{eq.hsb2rgb1}).
% A similar argument shows that $F$ indeed is a continuous function of \emph{hue} over the whole range $[0,1]$.
%
%
% \paragraph{Conversion \Model{hsb} to \Model{Hsb}}
% Only the first component has to be changed.
% \begin{gather}
% (\emph{hue\Circ}, \emph{saturation}, \emph{brightness}) := (H\cdot\emph{hue}, \emph{saturation}, \emph{brightness})
% \end{gather}
%
%
% \paragraph{Conversion \Model{hsb} to \Model{HSB}}
% As described in section \vref{sec.real2int}.
% \begin{gather}
% (\emph{Hue}, \emph{Saturation}, \emph{Brightness}) := \bigl(\RtoI M(\emph{hue}), \RtoI M(\emph{saturation}), \RtoI M(\emph{brightness})\bigr)
% \end{gather}
%
%
% \paragraph{Complement of \Model{hsb} color}
% We have not found a formula in the literature, therefore we give a short proof afterwards.
% \begin{lemma}
% The \textup{\Model{hsb}}-complement can be calculated by the following formulas:\em
% \begin{align}
% \emph{hue}^* & :=
% \begin{cases}
% \emph{hue} + \frac12 & \text{if $\emph{hue}<\frac12$}\\[1ex]
% \emph{hue} - \frac12 & \text{if $\emph{hue}\ge\frac12$}\\
% \end{cases}\\[1ex]
% \emph{brightness}^* & := 1 - \emph{brightness}\cdot(1-\emph{saturation})\\[1ex]
% \emph{saturation}^* & :=
% \begin{cases}
% 0 & \text{if $\emph{brightness}^*=0$}\\[1ex]
% \displaystyle\frac{\emph{brightness}\cdot\emph{saturation}}{\emph{brightness}^*} & \text{if $\emph{brightness}^*\ne0$}
% \end{cases}
% \end{align}
% \end{lemma}
%
% \begin{proof}
% Starting with the original color $C=(h,s,b)$, we define color $C^*=(h^*,s^*,b^*)$ by the given formulas, convert both $C$ and $C^*$ to the \Model{rgb} model and show that
% \begin{gather}
% C_{\Model{rgb}} + C_{\Model{rgb}}^* = b\cdot(E - s\cdot F) + b^*\cdot(E - s'\cdot F^*) \stackrel!= E,\label{eq.hsbcompl1}
% \end{gather}
% which means that $C_{\Model{rgb}}$ is the complement of $C_{\Model{rgb}}^*$.
% First we note that the parameters of $C^*$ are in the legal range $[0,1]$.
% This is obvious for $h^*,b^*$.
% From
% $b^* = 1-b\cdot(1-s) = 1 - b + b\cdot s$
% we derive $b\cdot s = b^* - (1-b) \le b^*$, therefore $s^*\in[0,1]$, and
% \begin{gather*}
% b^* = 0 \Leftrightarrow s=0 \text{ and } b=1.
% \end{gather*}
% Thus, equation (\ref{eq.hsbcompl1}) holds in the case $b^*=0$.
% Now we assume $b^*\ne0$, hence
% \begin{align*}
% C_{\Model{rgb}} + C_{\Model{rgb}}^*
% &= b\cdot(E - s\cdot F) + b^*\cdot\Bigl(E - \frac{b\cdot s}{b^*}\cdot F^*\Bigr) \\
% &= b\cdot E - b\cdot s\cdot F + b^*\cdot E - b\cdot s\cdot F^*\\[1ex]
% &= E - b\cdot s\cdot(F+F^*-E)
% \end{align*}
% since $b^*=1-b+bs$.
% Therefore, it is sufficient to show that
% \begin{gather}
% F+F^*=E.\label{eq.hsbcompl2}
% \end{gather}
% From
% \begin{gather*}\textstyle
% h<\frac12 \Rightarrow h^*=h+\frac12 \Rightarrow 6h^* = 6h+3 \Rightarrow i^*=i+3 \text{ and } f^*=f
% \end{gather*}
% it is easy to see from (\ref{eq.hsb2rgb2}) that equation (\ref{eq.hsbcompl2}) holds for the cases $i=0,1,2$.
% Similarly,
% \begin{gather*}\textstyle
% h\ge\frac12 \Rightarrow h^*=h-\frac12 \Rightarrow 6h^* = 6h-3 \Rightarrow i^*=i-3 \text{ and } f^*=f
% \end{gather*}
% and again from (\ref{eq.hsb2rgb2}) we derive (\ref{eq.hsbcompl2}) for the cases $i=3,4,5$.
% Finally, if $i=6$ then $f=0$ and $F+F^* = (0,1,1) + (1,0,0) = E$.
% \end{proof}
%
%
% \subsubsection{The \Model{Hsb} model}
%
% \paragraph{Conversion \Model{Hsb} to \Model{hsb}}
% Only the first component has to be changed.
% \begin{gather}
% (\emph{hue}, \emph{saturation}, \emph{brightness}) := (\emph{hue\Circ}/H, \emph{saturation}, \emph{brightness})
% \end{gather}
%
%
% \paragraph{Conversion \Model{Hsb} to \Model{tHsb}}
% Under the settings of (\ref{eq.tHsb1})--(\ref{eq.tHsb3}) we simply have to exchange the letters $x$ and $y$ in equation (\ref{eq.tHsb4}) to get the inverse transformation:
% \begin{gather}
% \displaystyle \emph{hue\Circ}\in\left[y_{\eta-1},y_\eta\right] \Rightarrow
% \emph{hue\Circ} := x_{\eta-1} + \frac{x_\eta - x_{\eta-1}}{y_\eta - y_{\eta-1}}\cdot(\emph{hue\Circ} - y_{\eta-1})
% \end{gather}
% while \emph{saturation} and \emph{brightness} are left unchanged.
%
%
% \subsubsection{The \Model{tHsb} model}
%
% \paragraph{Conversion \Model{tHsb} to \Model{Hsb}}\label{sec.tHsb2Hsb}
% \DescribeMacro\rangeHsb
% \DescribeMacro\rangetHsb
% We assume that $\texttt{\string\rangeHsb}=H$ and |\rangetHsb| expands to
% \begin{gather}
% x_1,y_1;x_2,y_2;\dots;x_{h-1},y_{h-1}\label{eq.tHsb1}
% \intertext{where}
% x_0:=0<x_1<x_2<\dots<x_{h-1}<x_h:=H\label{eq.tHsb2}\\
% y_0:=0<y_1<y_2<\dots<y_{h-1}<y_h:=H\label{eq.tHsb3}
% \end{gather}
% with an integer $h>0$.
% Now the $x$ and $y$ values determine a piecewise linear transformation:
% \begin{gather}
% \displaystyle \emph{hue\Circ}\in\left[x_{\eta-1},x_\eta\right] \Rightarrow
% \emph{hue\Circ} := y_{\eta-1} + \frac{y_\eta - y_{\eta-1}}{x_\eta - x_{\eta-1}}\cdot(\emph{hue\Circ} - x_{\eta-1})
% \label{eq.tHsb4}
% \end{gather}
% while \emph{saturation} and \emph{brightness} are left unchanged.
%
%
% \subsubsection{The \Model{gray} model}
%
% \paragraph{Conversion \Model{gray} to \Model{rgb}}
% Source: \cite{plrm}, p. 474.
% \begin{gather}
% (\emph{red}, \emph{green}, \emph{blue}) := \emph{gray}\cdot E
% \end{gather}
%
%
% \paragraph{Conversion \Model{gray} to \Model{cmy}}
% This is derived from the conversion chain $\Model{gray}\to\Model{rgb}\to\Model{cmy}$.
% \begin{gather}
% (\emph{cyan}, \emph{magenta}, \emph{yellow}) := (1-\emph{gray})\cdot E
% \end{gather}
%
%
% \paragraph{Conversion \Model{gray} to \Model{cmyk}}
% Source: \cite{plrm}, p. 475.
% \begin{gather}
% (\emph{cyan}, \emph{magenta}, \emph{yellow}, \emph{black}) := (0,0,0,1-\emph{gray})
% \end{gather}
%
%
% \paragraph{Conversion \Model{gray} to \Model{hsb}}
% This is derived from the conversion chain $\Model{gray}\to\Model{rgb}\to\Model{hsb}$.
% \begin{gather}
% (\emph{hue}, \emph{saturation}, \emph{brightness}) := (0,0,\emph{gray})
% \end{gather}
%
%
% \paragraph{Conversion \Model{gray} to \Model{Hsb}/\Model{tHsb}}
% This is derived from the conversion chain $\Model{gray}\to\Model{hsb}\to\Model{Hsb}$, followed by $\Model{Hsb}\to\Model{tHsb}$ if applicable.
% \begin{gather}
% (\emph{hue\Circ}, \emph{saturation}, \emph{brightness}) := (0,0,\emph{gray})
% \end{gather}
%
%
% \paragraph{Conversion \Model{gray} to \Model{Gray}}
% As described in section \vref{sec.real2int}.
% \begin{gather}
% \emph{Gray} := \RtoI N(\emph{gray})
% \end{gather}
%
%
% \paragraph{Complement of \Model{gray} color}
% This is similar to the \Model{rgb} case:
% \begin{gather}
% \emph{gray}^* := 1 - \emph{gray}
% \end{gather}
%
%
% \subsubsection{The \Model{RGB} model}
%
% \paragraph{Conversion \Model{RGB} to \Model{rgb}}
% As described in section \vref{sec.int2real}.
% \begin{gather}
% (\emph{red}, \emph{green}, \emph{blue}) := \bigl(\ItoR L(\emph{Red}), \ItoR L(\emph{Green}), \ItoR L(\emph{Blue})\bigr)
% \end{gather}
%
%
% \subsubsection{The \Model{HTML} model}
%
% \paragraph{Conversion \Model{HTML} to \Model{rgb}}
% As described in section \vref{sec.int2real}: starting with \emph{RRGGBB} set
% \begin{gather}
% (\emph{red}, \emph{green}, \emph{blue}) := \bigl(\ItoR{255}(\emph{RR}_{\emph{dec}}), \ItoR{255}(\emph{GG}_{\emph{dec}}), \ItoR{255}(\emph{BB}_{\emph{dec}})\bigr)
% \end{gather}
%
%
% \subsubsection{The \Model{HSB} model}
%
% \paragraph{Conversion \Model{HSB} to \Model{hsb}}
% As described in section \vref{sec.int2real}.
% \begin{gather}
% (\emph{hue}, \emph{saturation}, \emph{brightness}) := \bigl(\ItoR M(\emph{Hue}), \ItoR M(\emph{Saturation}), \ItoR M(\emph{Brightness})\bigr)
% \end{gather}
%
%
% \subsubsection{The \Model{Gray} model}
%
% \paragraph{Conversion \Model{Gray} to \Model{gray}}
% As described in section \vref{sec.int2real}.
% \begin{gather}
% \emph{gray} := \ItoR N(\emph{Gray})
% \end{gather}
%
%
% \subsubsection{The \Model{wave} model}
%
% \paragraph{Conversion \Model{wave} to \Model{rgb}}
% Source: based on \People{Dan}{Bruton}'s algorithm \cite{Bruton}.
% Let $\lambda$ be a visible wavelength, given in nanometers (nm), i.e., $\lambda\in\left[380,780\right]$.
% We assume further that $\gamma>0$ is a fixed number ($\gamma=0.8$ in \cite{Bruton}).
% First set
% \begin{align}
% (r,g,b) & :=
%  \begin{cases}
%   \displaystyle \Bigl(\frac{440-\lambda}{440-380},0,1\Bigr) & \text{if $\lambda\in[380,440[$}\\[1.75ex]
%   \displaystyle \Bigl(0,\frac{\lambda-440}{490-440},1\Bigr) & \text{if $\lambda\in[440,490[$}\\[1.75ex]
%   \displaystyle \Bigl(0,1,\frac{510-\lambda}{510-490}\Bigr) & \text{if $\lambda\in[490,510[$}\\[1.75ex]
%   \displaystyle \Bigl(\frac{\lambda-510}{580-510},1,0\Bigr) & \text{if $\lambda\in[510,580[$}\\[1.75ex]
%   \displaystyle \Bigl(1,\frac{645-\lambda}{645-580},0\Bigr) & \text{if $\lambda\in[580,645[$}\\[2.5ex]
%   \displaystyle (1,0,0) & \text{if $\lambda\in[645,780]$}\\
%  \end{cases}\label{eq.gamma2rgb1}\\
% \intertext{then, in order to let the intensity fall off near the vision limits,}
% f & :=
%  \begin{cases}
%   \displaystyle 0.3 + 0.7\cdot\frac{\lambda-380}{420-380} & \text{if $\lambda\in\left[380,420\right[$}\\[1.25ex]
%   \displaystyle 1 & \text{if $\lambda\in[420,700]$}\\[1ex]
%   \displaystyle 0.3 + 0.7\cdot\frac{780-\lambda}{780-700} & \text{if $\lambda\in\left]700,780\right]$}\\
%  \end{cases}\label{eq.gamma2rgb2}\\
% \intertext{and finally}
% (\emph{red},\emph{green},\emph{blue}) & := \bigl((f\cdot r)^\gamma, (f\cdot g)^\gamma, (f\cdot b)^\gamma\bigr)
% \end{align}
% The intermediate colors $(r,g,b)$ at the interval borders of equation (\ref{eq.gamma2rgb1}) are well-known:
% for $\lambda=380,440,490,510,580,645$ we get \Color{magenta}, \Color{blue}, \Color{cyan}, \Color{green}, \Color{yellow}, \Color{red}, respectively.
% These turn out to be represented in the \Model{hsb} model by $\emph{hue}=\frac56,\frac46,\frac36,\frac26,\frac16,\frac06$, whereas $\emph{saturation}=\emph{brightness}=1$ throughout the 6~colors.
% Furthermore, these \Model{hsb} representations are independent of the actual $\gamma$ value.
% Staying within this model framework, we observe that the intensity fall off near the vision limits --- as represented by equation (\ref{eq.gamma2rgb2}) --- translates into decreasing \emph{brightness} parameters towards the margins.
% A simple calculation shows that the edges $\lambda=380,780$ of the algorithm yield the colors |magenta!|$0.3^\gamma$|!black|, |red!|$0.3^\gamma$|!black|, respectively.
% We see no reason why we should not extend these edges in a similar fashion to end-up with true \Color{black} on either side.
% Now we are prepared to translate everything into another, more natural algorithm.
%
%
% \paragraph{Conversion \Model{wave} to \Model{hsb}}
% Let $\lambda>0$ be a wavelength, given in nanometers (nm), and let
% \begin{gather}
% \varrho : \bbbR \to \left[0,1\right],\ x \mapsto \bigl( \min\{ 1, \max\{ 0,x\} \} )^\gamma
% \end{gather}
% with a fixed correction number $\gamma>0$.
% Then
% \begin{align}
% \emph{hue} & := \displaystyle \frac16\cdot
%  \begin{cases}
%   \displaystyle 4 + \varrho\Bigl(\frac{\lambda-440}{380-440}\Bigr) & \text{if $\lambda<440$}\\[1.75ex]
%   \displaystyle 4 - \varrho\Bigl(\frac{\lambda-440}{490-440}\Bigr) & \text{if $\lambda\in[440,490[$}\\[1.75ex]
%   \displaystyle 2 + \varrho\Bigl(\frac{\lambda-510}{490-510}\Bigr) & \text{if $\lambda\in[490,510[$}\\[1.75ex]
%   \displaystyle 2 - \varrho\Bigl(\frac{\lambda-510}{580-510}\Bigr) & \text{if $\lambda\in[510,580[$}\\[1.75ex]
%   \displaystyle 0 + \varrho\Bigl(\frac{\lambda-645}{580-645}\Bigr) & \text{if $\lambda\in[580,645[$}\\[2.5ex]
%   \displaystyle 0 & \text{if $\lambda\ge645$}\\
%  \end{cases}\label{eq.gamma2hsb1}\\[1ex]
% \emph{saturation} & := 1\\[1ex]
% \emph{brightness} & :=
%  \begin{cases}
%   \displaystyle \varrho\Bigl(0.3 + 0.7\cdot\frac{\lambda-380}{420-380}\Bigr) & \text{if $\lambda<420$}\\[1.5ex]
%   \displaystyle 1 & \text{if $\lambda\in[420,700]$}\\[1ex]
%   \displaystyle \varrho\Bigl(0.3 + 0.7\cdot\frac{\lambda-780}{700-780}\Bigr) & \text{if $\lambda>700$}\\
%  \end{cases}\label{eq.gamma2hsb2}
% \end{align}
% For the sake of completeness we note that, independent of $\gamma$,
% \begin{gather*}
% (\emph{hue},\emph{saturation},\emph{brightness}) =
%  \begin{cases}
%   \bigl(\frac56,1,0\bigr) & \text{if $\lambda\le 380 - \frac{3\cdot(420-380)}7 = 362.857\dots$}\\[1.5ex]
%   \bigl(0,1,0\bigr) & \text{if $\lambda\ge 780 + \frac{3\cdot(780-700)}7 = 814.285\dots$}\\
%  \end{cases}\label{eq.gamma2hsb3}
% \end{gather*}
% What is the best (or, at least, a good) value for $\gamma$?
% In the original algorithm \cite{Bruton}, $\gamma=0.8$ is chosen.
% However, we could not detect significant visible difference between the cases $\gamma=0.8$ and $\gamma=1$.
% Thus, for the time being, \XC's implementation uses the latter value which implies a pure linear approach.
% In the \Package{pstricks} examples file \href{xcolor2.pdf}{\File{xcolor2.tex}}, there is a demonstration of different $\gamma$ values.
%
% \clearpage
%
%
%
% \begin{adjustwidth}{-2.5cm}{}
% \begingroup\raggedright
% \begin{thebibliography}{00}
% \addcontentsline{toc}{section}{References}
%
% \bibitem{plrm}%
%  {Adobe Systems Incorporated: ``PostScript Language Reference Manual''. Addison-Wesley, third edition, 1999.
%   \URL{http://www.adobe.com/products/postscript/pdfs/PLRM.pdf}}
%
% \bibitem{fbox}%
%  {\People{Donald}{Arseneau}: ``Patch so \cmd\fbox{} draws frame on top of text''. \LaTeX{} bug report, latex/3655, 2004/03/18.
%   \URL{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/3655}}
%
% \bibitem{url}%
%  {\People{Donald}{Arseneau}: \Package{url} package, ``2005/06/27  ver 3.2  Verb mode for urls, etc.''.
%   \CTAN{macros/latex/contrib/misc/}{url.sty}}
%
% \bibitem{Bruton}%
%  {\People{Dan}{Bruton}: ``Approximate RGB values for Visible Wavelengths'', 1996.
%   \URL{http://www.physics.sfasu.edu/astro/color/spectra.html}}
%
% \bibitem{dpc}%
%  {\People{David P.}{Carlisle}: ``Packages in the `graphics' bundle'', 2014.
%   \CTAN{macros/latex/required/graphics/}{grfguide.*}}
%
% \bibitem{color}%
%  {\People{David P.}{Carlisle}: \LCP, ``2016/01/03 v1.1b Standard LaTeX Color (DPC)''.
%   \CTAN{macros/latex/required/graphics/}{color.dtx}}
%
% \bibitem{colortbl}%
%  {\People{David P.}{Carlisle}: \Package{colortbl} package, ``2001/02/13 v0.1j Color table columns''.
%   \CTAN{macros/latex/contrib/colortbl/}{}}
%
% \bibitem{pstcol}%
%  {\People{David P.}{Carlisle}, \People{Herbert}{Vo\ss}, \People{Rolf}{Niepraschk}: \Package{pstcol} package, ``2005/11/16 v1.2 LaTeX wrapper for `PSTricks'{}''.
%   \CTAN{macros/graphics/pstricks/latex/}{pstcol.sty}}
%
% \bibitem{chroma}%
%  {\People{Uwe}{Kern}: ``Chroma: a reference book of \LaTeX{} colors''.
%   \CTAN{info/colour/chroma/}{} and
%   \URL{http://www.ukern.de/tex/chroma.html}}
%
% \bibitem{xcolor}%
%  {\People{Uwe}{Kern}: \Package{xcolor} package, ``\LaTeX{} color extensions''.
%   \CTAN{macros/latex/contrib/xcolor/}{} and
%   \URL{http://www.ukern.de/tex/xcolor.html}}
%
% \bibitem{mik}%
%  {MiK\TeX{} Project:
%   \URL{http://www.miktex.org/}}
%
% \bibitem{colorinfo}%
%  {\People{Rolf}{Niepraschk}: \Package{colorinfo} package, ``2003/05/04 v0.3c Info from defined colors''.
%   \CTAN{macros/latex/contrib/colorinfo/}{}}
%
% \bibitem{pdfcolmk}%
%  {\People{Heiko}{Oberdiek}: \Package{pdfcolmk} package, ``2006/02/20 v0.8 PDFtex COLor MarK''.
%   \CTAN{macros/latex/contrib/oberdiek/}{pdfcolmk.*}}
%
% \bibitem{hyperref}%
%  {\People{Sebastian}{Rahtz}, \People{Heiko}{Oberdiek}: \Package{hyperref} package, ``2006/09/06 v6.75e Hypertext links for \LaTeX''.
%   \CTAN{macros/latex/contrib/hyperref/}{}}
%
% \bibitem{smith}%
%  {\People{Alvy Ray}{Smith}: ``Color Gamut Transform Pairs''. \emph{Computer Graphics} (ACM SIGGRAPH), Volume 12, Number 3, August 1978.
%   \URL{http://alvyray.com/Papers/PapersCG.htm}}
%
% \bibitem{HTML4}%
%  {World Wide Web Consortium: ``HTML4 color keywords''.
%   \URL{http://www.w3.org/TR/css3-color/\#html4}}
%
% \bibitem{svg}%
%  {World Wide Web Consortium: ``Scalable Vector Graphics (\Index{SVG}) 1.1 Specification --- Basic Data Types and Interfaces''.
%   \URL{http://www.w3.org/TR/SVG11/types.html\#ColorKeywords}}
%
% \end{thebibliography}
% \endgroup
% \clearpage
%
% \columnsep2.25em
% \begin{multicols}{2}[\section*{Appendix}%
% \addcontentsline{toc}{section}{Appendix}]
%
% \subsection*{Acknowledgement}
% \addcontentsline{toc}{subsection}{Acknowledgement}
% This package is based on and contains code copied from \cite{color} (Copyright (C) 1994--1999 \People{David P.}{Carlisle}), which is part of the Standard \LaTeX{} `Graphics Bundle'.
% Although many commands and features have been added and most of the original \LC{} commands have been rewritten or adapted within \XC, the latter package would not exist without \LC.
% Thus, the author is grateful to \People{David P.}{Carlisle} for having created \LC{} and its accompanying files.
%
% \subsection*{Trademarks}
% \addcontentsline{toc}{subsection}{Trademarks}
% Trademarks appear throughout this documentation without any trademark symbol; they are the property of their respective trademark owner.
% There is no intention of infringement; the usage is to the benefit of the trademark owner.
%
% \raggedright
% \leftmargini1em
% \leftmarginii1em
% \leftmarginiii1em
%
% \subsection*{Known Issues}
% \addcontentsline{toc}{subsection}{Known Issues}
% \begin{itemize}
% \item |\rowcolors[\hline]...| does not work with \Package{longtable}.
% \end{itemize}
%
% \subsection*{History}
% \addcontentsline{toc}{subsection}{History}
%
% \subsubsection*{2016/05/11 v2.12}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item |\nopagecolor| command as introduced in \LC{} v1.1a (example added to \File{xcolor3.tex});
%   \item \Option{luatex} driver option (code provided by DPC) to fix incompatibilities due to changes in new Lua\TeX\ version.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item possible name conflict by |\XC@ifxcase| call;
%   \item incorrect internal |\@hex@@Hex| macro.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2007/01/21 v2.11}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item color names \Color{lime} and \Color{teal} added to the set of predefined colors.
%   \end{itemize}
% \item Bugfix:
%   \begin{itemize}
%   \item incorrect |\XC@strip@comma| call within \Package{hyperref}-related options.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2006/11/28 v2.10}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item \Option{fixinclude} option prevents \Program{dvips} from explicitly resetting current color to \Color{black} before actually inserting an \File{.eps} file via |\color{red}\includegraphics{foo}|.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item |\colorbox| and |\fcolorbox| made robust;
%   \item obsolete package option \oOption{pst} removed;
%   \item several changes to internal macros.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item incorrect processing of \Model{cmyk}-type current color `.'.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/12/21 v2.09}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item |\definecolor| and |\color| now accept space-separated color specifications, e.g., |\color| |[rgb]{1 .5 0}|;
%   \item experimental \Option{xcdraw} option extended to \Option{pdftex} and \Option{dvipdfm} drivers.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item test file \File{xcolor2.tex} made compatible with recent changes in \Package{pstricks};
%   \item test file \File{xcolor3.tex} extended;
%   \item driver test file \File{xcolor4.tex} extended to demonstrate the different frame drawing approaches;
%   \item more efficient implementation of driver-specific code.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/11/25 v2.08}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item more flexibility for |\fcolorbox| arguments, e.g., |\fcolorbox| |[gray]{0.5}[wave]{580}{test}|;
%   \item |\boxframe| returns a frame of given dimensions;
%   \item new implementation of |\f(rame)box| and |\fcolorbox| as an extension of bug report latex/3655 to reduce pixel positioning errors in output devices;
%   \item \Option{kernelfbox} option for those who prefer the previous |\f(rame)box| approach;
%   \item experimental \Option{xcdraw} option uses \Index{PostScript} commands to draw frames and color boxes in case of \Option{dvips}.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item insufficient expression type detection within |\colorlet|;
%   \item wrong calculation in the unit interval reduction for negative integers (affecting color series and extended color expressions).
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/11/12 v2.07}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item color model \Model{Hsb} allows to specify \emph{hue} in degrees;
%   \item color model \Model{tHsb} (\pModel{tuned} \Model{Hsb}) for user-defined \emph{hue} configuration on color wheels;
%   \item easy generation of color harmonies derived from \Model{Hsb} or \Model{tHsb} color wheels, e.g., |\color{red>wheel,1,12}| yields an `analogous' color to \Color{red} on a 12-spoke wheel;
%   \item additional 317 predefined color names according to \File{rgb.txt}, which is part of \Index{Unix}/\Index{X11} distributions;
%   \item \Option{svgnames} option extended by~4~colors taken from \File{rgb.txt};
%   \item enhanced syntax for immediate conversion, e.g., |\definecolor| |{foo}{rgb:gray}{0.3}| or |\color| |[rgb:wave]{478}|;
%   \item |\@ifundefinedcolor| and |\@ifundefinedmodel| commands;
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item enhanced documentation;
%   \item several changes to internal macros.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item wrong calculation of color series components in some cases of negative step parameters.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/10/15 v2.06}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item color model \Model{wave} for (approximate) visualisation of light wavelengths, still somewhat experimental;
%   \item pseudo-model \nModel{ps} for colors defined by literal \Index{PostScript} code in conjunction with \Package{pstricks} and \Option{dvips}; an illustrative example for a $\gamma$-correction approach is given in \href{xcolor2.pdf}{\File{xcolor2.tex}};
%   \item |\substitutecolormodel| command for replacement of missing or faulty driver-specific color models;
%   \item improved detection and handling of driver-specific color models;
%   \item \Option{dvipdfmx} and \Option{xetex} options to support these drivers;
%   \item generic driver test file \File{xcolor4.tex}.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item |\XC@strip@comma| doesn't generate a trailing space anymore, which improves also the output of the |testcolors| environment.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/09/30 v2.05}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item |testcolors| environment helps to test colors in different models, showing both the visual result and the model-specific parameters;
%   \item |\extractcolorspecs| puts model/color specification into two separate commands, as opposed to |\extractcolorspec|;
%   \item color names \Color{pink} and \Color{olive} added to the set of predefined colors.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item |\definecolor{foo}{named}{bar}| did not work in v2.04.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/09/23 v2.04}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item preparation for usage of additional -- driver-provided -- color models;
%   \item \Package{pstricks} users may now specify explicit color parameters within |\psset| and related commands, e.g., |\psset{linecolor=[rgb]{1,0,0}}|; an illustrative example is given in \href{xcolor2.pdf}{\File{xcolor2.tex}}.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item color model names sanitized (i.e., turned to catcode~12) throughout the package;
%   \item |\@namelet| command deprecated because of name clash with \Package{memoir} --- please use |\XC@let@cc| instead (more |\XC@let@..| commands are available as well);
%   \item simplified color conversion code by using the new |\XC@ifxcase| command;
%   \item some minor changes to internal macros.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/06/06 v2.03}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item \Option{fixpdftex} option loads \Package{pdfcolmk} package in order to improve pdf\TeX's color behaviour during page breaks.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item some minor changes to internal macros.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item due to an incorrect |\if| statement within |\XC@info|, |\colorlet| caused trouble whenever its second argument started with two identical letters, e.g., |\colorlet{rab}{oof}|;
%   \item argument processing of |\XC@getcolor| caused incompatibility with \Package{msc} package;
%   \item \Option{prologue} option caused incompatibility with \Package{preview} package.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/03/24 v2.02}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item |\aftergroupedef| command to reproduce |\aftergroupdef|'s behaviour prior to v2.01;
%   \item \XC's homepage \XCW{} now provides also a ready-to-run TDS-compliant archive containing all required files.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item |\rowcolors| and friends are solely enabled by the \Option{table} option;
%   \item |\@ifxempty| changed back to more robust variant of v2.00.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item |\psset{linecolor=\ifcase\foo| |red\or green\or blue\fi}| did not work with \Package{pstricks} (error introduced in v2.01).
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2005/03/15 v2.01}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item \Option{prologue} option for comprehensive `named' color support in conjunction with \Option{dvips}: on-the-fly generation of \Index{PostScript} prologue files with all color definitions, ready for \Program{dvips} inclusion and/or post-processing with device-specific parameters (e.g., spot colors);
%   \item \Program{dvips} prologue file \File{xcolor.pro} to support additional `named' colors;
%   \item |\colorlet| may now also be used to create named colors from arbitrary color expressions;
%   \item enhanced color definition syntax to allow for target-model specific color parameters, e.g., |\definecolor| |{red}{rgb/cmyk}{1,0,0/0,1,1,0}|, facilitating the usage of tailor-made colors both for displays and printers;
%   \item `deferred definition' of colors: |\preparecolor| and |\definecolors| enable decoupling of color specification and control sequence generation, especially useful (= memory saving) for large lists of colors, of which only a few names are actually used;
%   \item \Option{dvipsnames*} and \Option{svgnames*} options to support deferred definition.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item higher accuracy: most complement calculations are now exact for all 5-digit decimals;
%   \item |\rangeRGB| and similar variables may now be changed at any point in a document;
%   \item |\aftergroupdef| now performs only a first-level expansion of its code argument;
%   \item |\XCfileversion| and similar internal constants removed from \File{.sty} and \File{.def} files;
%   \item improved memory management (reduced generation of `multiletter control sequences' by |\@ifundefined| tests);
%   \item several internal macros improved and/or renamed.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item |\XC@getcolor| could cause unwanted spaces when |\psset| was used inside |pspicture| environments (\Package{pstricks});
%   \item arithmetic overflow could happen when too many decimal digits were used within color parameters, e.g., as a result of \Package{fp} calculations.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2004/07/04 v2.00}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item extended functionality for color expressions: mix colors like a painter;
%   \item support for color blending: specify color mix expressions that are being blended with every displayed color;
%   \item |\xglobal| command for selective control of globality for color definitions, blends, and masks;
%   \item multiple step operations (e.g., |\color{foo!!+++}|) and access to individual members (e.g., |\color{foo!![7]}|) in color series;
%   \item |\providecolor| command to define only non-existent colors;
%   \item |\definecolorset| and |\providecolorset| commands to facilitate the construction of color sets with common underlying color model;
%   \item additional 147 predefined color names according to \Index{SVG}~1.1 specification;
%   \item \Key{xpdfborder} key for setting the width of hyperlink borders in a more driver-independent way if \Program{dvips} is used.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item \LCP{} now completely integrated within \XC;
%   \item \oOption{override}, \oOption{usenames}, \oOption{nodvipsnames} options and |\xdefinecolor| command no longer needed;
%   \item \Option{dvips} and \Option{dvipsnames} options now independent of each other;
%   \item |\tracingcolors|'s behaviour changed to make it more versatile and reduce log file size in standard cases;
%   \item |\rdivide|'s syntax made more flexible (divide by numbers and/or dimensions);
%   \item code restructured, some internal commands renamed;
%   \item documentation rearranged and enhanced.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item |\definecolor{foo}{named}{bar}| did not work (error introduced in v1.11);
%   \item more robust behaviour of conditionals within \Package{pstricks} key-values.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2004/05/09 v1.11}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item switch |\ifglobalcolors| to control whether color definitions are global or local;
%   \item option \Option{hyperref} provides color expression support for the border colors of hyperlinks, e.g., |\hypersetup| |{xurlbordercolor=red!50!yellow}|;
%   \item internal hooks |\XC@bcolor|, |\XC@mcolor|, and |\XC@ecolor| for additional code that has to be executed immediately before/after the current color is being displayed.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item |\XC@logcolor| renamed to |\XC@display|, which is now the core color display command;
%   \item improved interface to \Package{pstricks}.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2004/03/27 v1.10}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item support for \nModel{named} model;
%   \item support for \Program{dvips} colors (may now be used within color expressions);
%   \item internal representation of `ordinary' and `named' colors merged into unified data structure;
%   \item allow multiple `-' signs at the beginning of color expressions.
%   \end{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item commands like |\color[named]{foo}| caused errors when color masking or target model conversion were active;
%   \item incompatibility with \Package{soul} package: commands |\hl|, |\ul|, etc. could yield unexpected results.
%   \end{itemize}
% \item Documentation:
%   \begin{itemize}
%   \item added formula for general color expressions;
%   \item enhanced text and index;
%   \item removed dependence of index generation on local configuration file.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2004/02/16 v1.09}
% \begin{itemize}
% \item New features:
%   \begin{itemize}
%   \item color model \Model{HTML}, a 24-bit hexadecimal \Model{RGB} variant; allows to specify colors like |\color[HTML]{AFFE90}|;
%   \item color names \Color{orange}, \Color{violet}, \Color{purple}, and \Color{brown} added to the set of predefined colors.
%   \end{itemize}
% \item New \XC{} homepage: \XCW
% \item Bugfix: |\xdefinecolor| sometimes did not normalise its parameters.
% \item Changes:
%   \begin{itemize}
%   \item slight improvements of the documentation;
%   \item example file |xcolor1.tex| reorganised and abridged.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2004/02/04 v1.08}
% \begin{itemize}
% \item New commands:
%   \begin{itemize}
%   \item |\selectcolormodel| to change the target model within a document;
%   \item |\adjustUCRBG| to fine-tune undercolor-removal and black-generation during conversion to \Model{cmyk}.
%   \end{itemize}
% \item Bugfix: color expressions did not work correctly in connection with active `!' character, e.g., in case of |\usepackage[frenchb]babel}|.
% \item Code re-organisation:
%   \begin{itemize}
%   \item |\XC@xdefinecolor| merged into |\xdefinecolor|, making the first command obsolete;
%   \item several internal commands improved/streamlined.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2004/01/20 v1.07}
% \begin{itemize}
% \item New feature: support for color masking and color separation.
% \item New commands:
%   \begin{itemize}
%   \item |\rmultiply| to multiply a dimension register by a real number;
%   \item |\xcolorcmd| to pass commands that are to be executed at the end of the package.
%   \end{itemize}
% \item Changes:
%   \begin{itemize}
%   \item more consistent color handling: extended colors now always take precedence over standard colors;
%   \item several commands improved by using code from the \LaTeX{} kernel.
%   \end{itemize}
% \item Documentation: some minor changes.
% \item Example files: additional \Package{pstricks} examples (file \href{xcolor2.pdf}{\File{xcolor2.tex}}).
% \end{itemize}
%
% \subsubsection*{2003/12/15 v1.06}
% \begin{itemize}
% \item New feature: extended color expressions, allowing for cascaded mix operations, e.g., |\color{red!30!green!40!blue}|.
% \item Documentation: new section on color expressions.
% \item Bugfix:~color series stepping did not work correctly within non-displaying commands like |\extractcolorspec{foo!!+}| (this bug was introduced in v1.05).
% \item Renamed~commands:~|\ukfileversion| and similar internal constants renamed to |\XCfileversion| etc.
% \item Removed~commands:~|\ifXCpst| and |\ifXCtable| made obsolete by a simple trick.
% \end{itemize}
%
% \subsubsection*{2003/11/21 v1.05}
% \begin{itemize}
% \item Bugfixes:
%   \begin{itemize}
%   \item package option \Option{hideerrors} should now work as expected;
%   \item usage of `.' in the first color expression in a document caused an error due to incorrect initialisation.
%   \end{itemize}
% \item Code re-organisation: |\extractcolorspec| now uses |\XC@splitcolor|, making |\XC@extract| obsolete.
% \end{itemize}
%
% \subsubsection*{2003/11/09 v1.04}
% \begin{itemize}
% \item New feature: easy access to current color within color expressions.
% \item New option: \oOption{override} to replace |\definecolor| by |\xdefinecolor|.
% \item New command: |\tracingcolors| for logging color-specific information.
% \end{itemize}
%
% \subsubsection*{2003/09/21 v1.03}
% \begin{itemize}
% \item Change: bypass strange behaviour of some drivers.
% \item New feature: driver-sharing with \Package{hyperref}.
% \end{itemize}
%
% \subsubsection*{2003/09/19 v1.02}
% \begin{itemize}
% \item Change: |\extractcolorspec| and |\colorlet| now also accept color series as arguments.
% \end{itemize}
%
% \subsubsection*{2003/09/15 v1.01}
% \begin{itemize}
% \item New feature: |\definecolorseries| and friends.
% \item Documentation: removed some \Package{doc}-related side-effects.
% \item Code re-organisation: all calculation-related tools put to one place.
% \item Bugfixes:
%   \begin{itemize}
%   \item |\@rdivide|: added |\relax| to fix problem with negative numerators;
%   \item |\rowc@l@rs|: replaced |\@ifempty| by |\@ifxempty|.
%   \end{itemize}
% \end{itemize}
%
% \subsubsection*{2003/09/09 v1.00}
% \begin{itemize}
% \item First published release.
% \end{itemize}
%
% \end{multicols}
% \end{adjustwidth}
%
% \StopEventually{}
% \clearpage
%
% \section{The Implementation}
%
% Some commands have been copied unchanged from \cite{color} (Copyright (C) 1994--1999 \People{David P.}{Carlisle}), which is part of the Standard \LaTeX{} `Graphics Bundle'.
% Additionally, also some parts of the code documentation were copied from \cite{color}.
%
%
%
% \subsection{Preparation}
%
% \subsubsection{File identification}
%
% \renewcommand*\MacroFont{\footnotesize\ttfamily}
% \renewcommand*\AltMacroFont{\footnotesize\ttfamily\slshape}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% \fbox{\MacroFont\string\ProvidesPackage\string{xcolor\string}[\XCfiledate\space\XCfileversion\space LaTeX color extensions (UK)]}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%    \end{macrocode}
%
%
% \subsubsection{Safety first}
%
% \begin{macro}{\XC@catcodes}
% Save catcodes for later restore:
%    \begin{macrocode}
\expandafter\edef\csname XC@catcodes\endcsname
 {\catcode33 \the\catcode33 % !
  \catcode34 \the\catcode34 % "
  \catcode39 \the\catcode39 % '
  \catcode42 \the\catcode42 % *
  \catcode44 \the\catcode44 % ,
  \catcode45 \the\catcode45 % -
  \catcode46 \the\catcode46 % .
  \catcode47 \the\catcode47 % /
  \catcode58 \the\catcode58 % :
  \catcode59 \the\catcode59 % ;
  \catcode60 \the\catcode60 % <
  \catcode61 \the\catcode61 % =
  \catcode62 \the\catcode62 % >
  \catcode63 \the\catcode63 % ?
  \catcode64 \the\catcode64 % @
  \catcode94 \the\catcode94 % ^
  \catcode96 \the\catcode96 % `
  \catcode`\noexpand\^^A\the\catcode`\^^A\relax}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\catcode64 11 %
\@makeother\! \@makeother\" \@makeother\' \@makeother\* \@makeother\,
\@makeother\- \@makeother\. \@makeother\/ \@makeother\: \@makeother\;
\@makeother\< \@makeother\= \@makeother\> \@makeother\? \@makeother\`
\catcode94 7 %
\catcode`\^^A=14 %
%    \end{macrocode}
%
%
% \subsubsection{Constants}
%
%  \begin{macro}{\XC@@}
% Macro consisting of the macro |\\XC@@|, serves as a delimiter.
%    \begin{macrocode}
\edef\XC@@{\expandafter\noexpand\csname\string\XC@@\endcsname}
%    \end{macrocode}
%  \end{macro}
%
%
% \subsubsection{Switches}
%
%  \begin{macro}{\ifcolors@}
% This boolean can be tested by higher level macros that may want to alter their behaviour if a monochrome driver is being used.
%    \begin{macrocode}
\newif\ifcolors@ \colors@true
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\ifcolorerrors@}
% Controls whether missing color models/names result in error or warning messages.
%    \begin{macrocode}
\newif\ifcolorerrors@
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\ifglobalcolors}
% Controls whether |\definecolor| and |\colorlet| generate global or local color definitions.
%    \begin{macrocode}
\newif\ifglobalcolors \globalcolorsfalse
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifdefinecolors}
% Controls whether |\definecolorset| should \emph{define} or \emph{prepare} colors.
%    \begin{macrocode}
\newif\ifdefinecolors \definecolorstrue
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifconvertcolorsD}
% \begin{macro}{\ifconvertcolorsU}
% Control whether conversion to target models take place at \emph{definition} time (|\ifconvertcolorsD|) and/or \emph{usage} (|\ifconvertcolorsU|).
%    \begin{macrocode}
\newif\ifconvertcolorsD
\newif\ifconvertcolorsU
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifblendcolors}
% \begin{macro}{\ifmaskcolors}
% Control whether colors are to be blended and/or masked at display time.
%    \begin{macrocode}
\newif\ifblendcolors
\newif\ifmaskcolors
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifXC@@fbox}
% \begin{macro}{\ifXC@@tst}
% Auxiliary test variables.
%    \begin{macrocode}
\newif\ifXC@@fbox \XC@@fboxtrue
\newif\ifXC@@tst
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Error handling}
%
% \begin{macro}{\c@lor@error}
% Multi-purpose error handler (issues warnings instead of errors if the \Option{hideerrors} option is used).
% This command is used already in the options section.
%    \begin{macrocode}
\def\c@lor@error#1%
 {\ifcolorerrors@\PackageError{xcolor}{Undefined color #1}\@ehc
  \else\PackageWarning{xcolor}{Undefined color #1}\fi}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Macro concatenation}
%
% \begin{macro}{\XC@append}
%   \marg{cmd}\marg{token list}\\
% Append \Meta{token list} to the definition of \Meta{cmd}.
% This command is used already in the options section.
%    \begin{macrocode}
\def\XC@append#1#2%
 {\ifx#1\@undefined\def#1{#2}\else\ifx#1\relax\def#1{#2}\else
  \toks@\expandafter{#1#2}\edef#1{\the\toks@}\fi\fi}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Macro definition}
%
% The following |\XC@let@..| commands mimic \LaTeX3's coding syntax for the type of arguments used:
% the `c' type is for brace delimited arguments which turn into a control sequence inside |\csname ... \endcsname|, whereas `N' is just a single token.
% Thanks to \People{Morten}{H\o gholm} for pointing me to that.
%
% \begin{macro}{\XC@let@cc}
%   \marg{target character string}\marg{source character string}\\
% Performs |\let\|\Meta{target character string}|=\|\Meta{source character string}.
%    \begin{macrocode}
\def\XC@let@cc#1{\expandafter\XC@let@Nc\csname#1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@namelet}
% This is provided for compatibility reasons only, although deprecated because of a name clash with \Package{memoir}.
%    \begin{macrocode}
\providecommand*\@namelet[1]{\expandafter\XC@let@Nc\csname#1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@let@Nc}
%   \marg{target name}\marg{source character string}\\
% Performs |\let|\Meta{target name}|=\|\Meta{source character string}.
% Formerly called |\@@namelet|.
%    \begin{macrocode}
\def\XC@let@Nc#1#2{\expandafter\let\expandafter#1\csname#2\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@let@cN}
%   \marg{target character string}\marg{source name}\\
% Performs |\let\|\Meta{target character string}|=|\Meta{source name}.
%    \begin{macrocode}
\def\XC@let@cN#1{\expandafter\let\csname#1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@namexdef}
%   \marg{character string}\marg{code}\\
% Performs |\xdef\|\Meta{character string}|{|\Meta{code}|}|.
% Similar to the \LaTeX{} internal |\@namedef| command.
%    \begin{macrocode}
\def\@namexdef#1{\expandafter\xdef\csname #1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\aftergroupdef}
% \begin{macro}{\aftergroupedef}
%   \marg{cmd}\marg{code}\\
% Defines \meta{cmd} with the first-level or complete expansion of \meta{code} after the end of the current group.
%    \begin{macrocode}
\def\aftergroupdef#1#2%
 {\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#2}}
\def\aftergroupedef#1#2%
 {\edef\@@tmp{\def\noexpand#1{#2}}\expandafter\endgroup\@@tmp}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\XC@edef}
% \begin{macro}{\XC@mdef}
% \begin{macro}{\XC@sdef}
%   \marg{cmd}\marg{code}\\
% Defines \Meta{cmd} as a safe expansion of \Meta{code}; needed for color expressions in certain languages.
% The second form is a streamlined version that takes only care of active `|/|' and `|:|' characters that may occur in \Meta{model-list} and \Meta{spec-list} arguments.
% The third form defines a sanitized expansion without considering active characters.
% It is faster since it needs no grouping operation.
%    \begin{macrocode}
\begingroup
\catcode`\!=13 \catcode`\:=13 \catcode`\-=13 \catcode`\+=13
\catcode`\;=13 \catcode`\/=13 \catcode`\"=13 \catcode`\>=13
\gdef\XC@edef#1#2%
 {\begingroup
  \ifnum\catcode`\!=13 \edef!{\string!}\fi
  \ifnum\catcode`\:=13 \edef:{\string:}\fi
  \ifnum\catcode`\-=13 \edef-{\string-}\fi
  \ifnum\catcode`\+=13 \edef+{\string+}\fi
  \ifnum\catcode`\;=13 \edef;{\string;}\fi
  \ifnum\catcode`\"=13 \edef"{\string"}\fi
  \ifnum\catcode`\>=13 \edef>{\string>}\fi
  \edef#1{#2}\@onelevel@sanitize#1\aftergroupdef#1#1}
\gdef\XC@mdef#1#2%
 {\begingroup
  \ifnum\catcode`\/=13 \edef/{\string/}\fi
  \ifnum\catcode`\:=13 \edef:{\string:}\fi
  \edef#1{#2}\@onelevel@sanitize#1\aftergroupdef#1#1}
\endgroup
\def\XC@sdef#1#2{\edef#1{#2}\@onelevel@sanitize#1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Conditional processing}
%
% \begin{macro}{\@ifxempty}
%   \marg{arg}\marg{empty}\marg{non-empty}\\
% Tests without expanding, whether the argument \Meta{arg} is empty and executes the following code accordingly; \Meta{arg} must not start with the token |\XC@@|.
% Can also be used within |\edef|.
%    \begin{macrocode}
\def\@ifxempty#1{\@@ifxempty#1\@@ifxempty\XC@@}
\def\@@ifxempty#1#2\XC@@
 {\ifx#1\@@ifxempty
  \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@ifxcase}
%   \marg{cmd}|{{|\Meta[1]{cmd}|}{|\Meta[1]{code}|}...{|\Meta[n]{cmd}|}{|\Meta[n]{code}|}}|\marg{default code}\\
% Performs the test |\ifx|\Meta{cmd}\Meta[k]{cmd} for $k=1,\dots,n$.
% If for some $k$ the test is `true', then the attached code \Meta[k]{code} is executed.
% If all tests are `false', then \Meta{default code} is executed.
%    \begin{macrocode}
\long\def\XC@ifxcase#1#2#3%
 {\long\def\XC@if@##1##2%
   {\ifx#1##1%
      \toks@{##2}\expandafter\remove@to@nnil\else\expandafter\XC@if@\fi}%
  \XC@if@#2#1{#3}\@nnil\the\toks@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@ifcase}
%   \marg{str}|{{|\Meta[1]{str-list}|}{|\Meta[1]{code}|}...{|\Meta[n]{str-list}|}{|\Meta[n]{code}|}}|\marg{default code}\\
% Tests whether \Meta{str} appears in one of the comma-separated lists \Meta[k]{str-list}.
% Performs the test |\if|\Meta{str}\Meta[kl]{str} for $k=1,\dots,n$ and $l=1,\ldots,m_n$.
% If for some $k,l$ the test is `true', then the attached code \Meta[k]{code} is executed.
% If all tests are `false', then \Meta{default code} is executed.
%    \begin{macrocode}
\long\def\XC@ifcase#1#2#3%
 {\long\def\XC@if@##1##2%
   {\@expandtwoargs\in@{,#1,}{,##1,}\ifin@
      \toks@{##2}\expandafter\remove@to@nnil\else\expandafter\XC@if@\fi}%
  \XC@if@#2{#1}{#3}\@nnil\the\toks@}
%    \end{macrocode}
% \end{macro}
%
%
%
% \subsection{Package options}
%
% \begin{macro}{\XC@@opt}
% Initialise the macro to hold the names of \emph{executed} \XCP{} options.
%    \begin{macrocode}
\def\XC@@opt{,}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ifXCopt}
%   \marg{option}\marg{executed}\marg{not executed}\\
% Performs action dependent on whether a specific \XCP{} option has been executed or not.
%    \begin{macrocode}
\def\@ifXCopt#1%
 {\@expandtwoargs\in@{,#1,}{\XC@@opt}%
  \ifin@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@@pkg}
% Initialise the macro to hold the names of packages that are to be loaded by \XC.
%    \begin{macrocode}
\let\XC@@pkg\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareOption}
% |\DeclareOption| has to be redefined in order to collect every executed package option in |\XC@@opt|.
% This is being restored immediately before |\ProcessOptions|; thus, other packages use the original definition.
%    \begin{macrocode}
\let\XC@declareoption\@declareoption
\long\def\@declareoption#1#2%
 {\XC@declareoption{#1}{\edef\XC@@opt{\XC@@opt#1,}#2}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Color model selection}
%
% \begin{macro}{\selectcolormodel}
%   \marg{num model}\\
% Determines the target model for color definitions with |\definecolor| and friends.
%    \begin{macrocode}
\def\selectcolormodel#1%
 {\@ifundefined{XC@mod@#1}%
   {\c@lor@error{target model `#1'}}%
   {\expandafter\ifx\csname XC@mod@#1\endcsname\XC@mod@natural
      \def\XC@tgt@mod##1{##1}\convertcolorsDfalse\convertcolorsUfalse
    \else\expandafter\ifx\csname XC@mod@#1\endcsname\XC@mod@named
      \c@lor@error{target model `#1'}
    \else
      \edef\XC@tgt@mod##1{#1}\convertcolorsDtrue\convertcolorsUtrue
    \fi\fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@mod@Hsb}
% \begin{macro}{\XC@mod@tHsb}
% \begin{macro}{\XC@mod@ignore}
% \begin{macro}{\XC@mod@named}
% \begin{macro}{\XC@mod@ps}
% \begin{macro}{\XC@mod@wave}
% \begin{macro}{\XC@mod@natural}
% \begin{macro}{\XC@mod@rgb}
% \begin{macro}{\XC@mod@cmy}
% \begin{macro}{\XC@mod@cmyk}
% \begin{macro}{\XC@mod@hsb}
% \begin{macro}{\XC@mod@gray}
% \begin{macro}{\XC@mod@RGB}
% \begin{macro}{\XC@mod@HTML}
% \begin{macro}{\XC@mod@HSB}
% \begin{macro}{\XC@mod@Gray}
% Put model names into commands and define package options
% \Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}.
%    \begin{macrocode}
\@tfor\@@tmp:={Hsb}{tHsb}{ignore}{named}{ps}{wave}\do
 {\expandafter\XC@sdef\csname XC@mod@\@@tmp\endcsname{\@@tmp}}
%    \end{macrocode}
%
%    \begin{macrocode}
\@tfor\@@tmp:={natural}{rgb}{cmy}{cmyk}{hsb}{gray}{RGB}{HTML}{HSB}{Gray}\do
 {\expandafter\XC@sdef\csname XC@mod@\@@tmp\endcsname{\@@tmp}%
  \edef\@@tmp
   {\noexpand\DeclareOption{\@@tmp}{\noexpand\selectcolormodel{\@@tmp}}}%
  \@@tmp}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% The \Option{monochrome} option should be used \emph{in addition} to one of the standard driver options.
%    \begin{macrocode}
\DeclareOption{monochrome}
 {\ExecuteOptions{hideerrors}%
  \AtEndOfPackage
   {\colors@false
    \def\set@color{\c@lor@special\m@ne
      {color push \current@color}\aftergroup\reset@color}%
    \def\reset@color{\c@lor@special\m@ne{color pop}}%
    \def\set@page@color{\c@lor@special\m@ne{background \current@color}}}}
%    \end{macrocode}
%
%
% \subsubsection{Sets of predefined colors}
%
% \begin{macro}{\XC@@names}
% Initialise the macro to hold the names of files that contain predefined colors; these files are loaded near to the end of this package.
%    \begin{macrocode}
\let\XC@@names\relax
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\colornameprefix}
% \begin{macro}{\XC@@nameprefix}
% Initialise the macro to hold the string that is prefixed to driver-specific color names.
% Save the value for later restore.
%    \begin{macrocode}
\providecommand*\colornameprefix{XC@}
\let\XC@@nameprefix\colornameprefix
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\XC@declarenames}
%   \marg{base name}\marg{file name}\marg{initial commands}\\
% Construct package options for color names.
%    \begin{macrocode}
\def\XC@declarenames#1#2#3%
 {\DeclareOption{#1}{\XC@append\XC@@names
   {#3\definecolorstrue\input{#2.def}\definecolorstrue
    \let\colornameprefix\XC@@nameprefix}}
  \DeclareOption{#1*}{\XC@append\XC@@names
   {#3\definecolorsfalse\input{#2.def}\definecolorstrue
    \let\colornameprefix\XC@@nameprefix}}}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\XC@declarenames{dvipsnames}{dvipsnam}{\let\colornameprefix\@empty}
\XC@declarenames{svgnames}{svgnam}{}
\XC@declarenames{x11names}{x11nam}{}
\XC@declarenames{hksnames}%
 {hks\ifcase\paperquality k\or n\or k\or z\else n\fi nam}{}
\XC@declarenames{pmsnames}{pmsnam}{}
\XC@declarenames{ralnames}{ralnam}{}
%    \end{macrocode}
%
%
% \subsubsection{Support for other packages}
%
% Use this option to load \People{David P.}{Carlisle}'s \Package{colortbl} package:
%    \begin{macrocode}
\DeclareOption{table}{\XC@append\XC@@pkg{\RequirePackage{colortbl}}}
%    \end{macrocode}
%
% Use this option to load \People{Heiko}{Oberdiek}'s \Package{pdfcolmk} package:
%    \begin{macrocode}
\DeclareOption{fixpdftex}{\XC@append\XC@@pkg{\RequirePackage{pdfcolmk}}}
%    \end{macrocode}
%
% \begin{macro}{\KV@Hyp@xcitebordercolor}
% \begin{macro}{\KV@Hyp@xfilebordercolor}
% \begin{macro}{\KV@Hyp@xlinkbordercolor}
% \begin{macro}{\KV@Hyp@xmenubordercolor}
% \begin{macro}{\KV@Hyp@xpagebordercolor}
% \begin{macro}{\KV@Hyp@xrunbordercolor}
% \begin{macro}{\KV@Hyp@xurlbordercolor}
% \begin{macro}{\KV@Hyp@xpdfborder}
% Use this option to define the extended keys for the \Package{hyperref} package.
%    \begin{macrocode}
\DeclareOption{hyperref}
 {\@tfor\@@tmp:={cite}{file}{link}{menu}{page}{run}{url}\do
   {\expandafter\edef\csname KV@Hyp@x\@@tmp bordercolor\endcsname #1%
     {\noexpand\XC@bordercolor{\@@tmp}{#1}}}%
  \AtEndOfPackage
   {\GetGinDriver\def\KV@Hyp@xpdfborder#1{\edef\@pdfborder{#1}}%
    \@tfor\@@tmp:={dvips}\do
     {\ifx\GinDriver\@@tmp
       \def\KV@Hyp@xpdfborder#1%
        {\edef\@pdfborder{#1}\expandafter\XC@pdfborder\@pdfborder\relax}%
      \@break@tfor\fi}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Driver options}
%
% \begin{macro}{\Gin@driver}
% Initialise the macro to hold the driver file name.
%    \begin{macrocode}
\providecommand*\Gin@driver{}
%    \end{macrocode}
%
% Drivers that come with their individual definition files:
%    \begin{macrocode}
\@tfor\@@tmp:={dvipdf}{dvipdfm}{dvipdfmx}{dvips}{dvipsone}{dviwin}%
              {emtex}{luatex}{pctex32}{pctexhp}{pctexps}{pctexwin}{pdftex}%
              {tcidvi}{textures}{truetex}{vtex}{xetex}\do
 {\edef\@@tmp{\noexpand\DeclareOption{\@@tmp}%
    {\def\noexpand\Gin@driver{\@@tmp.def}}}%
  \@@tmp}
%    \end{macrocode}
%
% Drivers that are derivatives of others:
%    \begin{macrocode}
\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}
\DeclareOption{oztex}{\ExecuteOptions{dvips}}
\DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}}
%    \end{macrocode}
%
% Options used by (some) drivers.
%    \begin{macrocode}
\DeclareOption{xcdraw}{\def\XC@@xcd@{1}}
\DeclareOption{noxcdraw}{\def\XC@@xcd@{-1}}
\DeclareOption{fixinclude}{\def\XC@@xcf@{1}}
\DeclareOption{prologue}{\def\XC@@xcp@{1}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Other options}
%
% Switch to original kernel |\fbox| command instead of new \XC{} version.
%    \begin{macrocode}
\DeclareOption{kernelfbox}{\XC@@fboxfalse}
%    \end{macrocode}
%
% These options control how non-existing colors are treated:
%    \begin{macrocode}
\DeclareOption{showerrors}{\colorerrors@true}
\DeclareOption{hideerrors}{\colorerrors@false}
%    \end{macrocode}
%
% The \Option{debugshow} option turns on debugging info (perhaps).
%    \begin{macrocode}
\DeclareOption{debugshow}{\catcode`\^^A=9 \let\GDebug\typeout}
%    \end{macrocode}
%
% All other options (including \LC's \oOption{usenames}, \oOption{nodvipsnames}) are being ignored.
%    \begin{macrocode}
\DeclareOption*%
 {\PackageInfo{xcolor}{Package option `\CurrentOption' ignored}}
%    \end{macrocode}
%
% Choose default options:
%    \begin{macrocode}
\def\XC@@xcd@{-1}
\def\XC@@xcf@{-1}
\def\XC@@xcp@{-1}
\ExecuteOptions{natural,showerrors}
%    \end{macrocode}
%
%
% \subsubsection{Processing options}
%
% A local configuration file may declare more options.
% It should also make one driver option the default, by calling |\ExecuteOptions| with the appropriate option.
%    \begin{macrocode}
\InputIfFileExists{color.cfg}{}{}
%    \end{macrocode}
%
% After the options are processed, load the appropriate driver file.
% If a site wants a default driver (e.g., \Option{dvips}) it just needs to put |\ExecuteOptions{dvips}| in a \File{color.cfg} file.
%    \begin{macrocode}
\let\@declareoption\XC@declareoption
\ProcessOptions\relax
%    \end{macrocode}
%
% \begin{macro}{\XC@@drv}
% Holds the name of the loaded driver (without \File{.def} extension).
%    \begin{macrocode}
\edef\Gin@driver{\Gin@driver}
\if!\Gin@driver!
  \PackageError{xcolor}
    {No driver specified}
    {You should make a default driver option in a file \MessageBreak
     color.cfg\MessageBreak
     eg: \protect\ExecuteOptions{dvips}}
\else
  \PackageInfo{xcolor}{Driver file: \Gin@driver}
  \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{}
  \def\@@tmp#1.def{\def\XC@@drv{#1}}
  \expandafter\@@tmp\Gin@driver
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@@xcd@}
% \begin{macro}{\XC@@xcf@}
% \begin{macro}{\XC@@xcp@}
% These are used firstly by the \Option{xcdraw} and \Option{prologue} options, indicating whether either option is switched on or off.
% Secondly, the macros serve as test variables for |\ifcase| expressions, storing the intended type of output: $-1=\text{dvi}, 0=\text{ps}, 1=\text{pdf}$.
%    \begin{macrocode}
\count@\XC@@xcd@ \advance\count@\XC@@xcf@ \advance\count@\XC@@xcp@\relax
\ifnum\count@>-3
%    \end{macrocode}
%
% \begin{macro}{\XC@special}
%   \meta{code}\\
% Driver-specific variant of |\special|.
% Even if the intended type of output is the same (e.g., pdf), the |\special| commands may differ.
%    \begin{macrocode}
  \XC@ifcase\XC@@drv
   {{dvips,pctex32}%
    {\def\@tempa{0}
     \def\XC@special#1{\special{ps:XC!b}\special{"#1}\special{ps:XC!e}}}%
    {pdftex}%
    {\def\@tempa{1}
     \def\XC@special#1{\pdfliteral{ q #1 Q }}}%
    {luatex}%
    {\def\@tempa{1}
     \ifnum\luatexversion<87%
       \def\XC@special#1{\pdfliteral{ q #1 Q }}%
     \else%
       \def\XC@special#1{\pdfextension literal{ q #1 Q }}%
     \fi}%
    {dvipdfm}%
    {\def\@tempa{1}
     \def\XC@special#1{\special{pdf: content #1}}}%
   }{\def\@tempa{-1}}
%    \end{macrocode}
% \end{macro}
%
% Since the options are independent of each other, we have to adjust the affiliated test variables independently as well.
%    \begin{macrocode}
  \ifnum\XC@@xcd@>\m@ne\let\XC@@xcd@\@tempa\fi
  \ifnum\XC@@xcf@>\m@ne\let\XC@@xcf@\@tempa\fi
  \ifnum\XC@@xcp@>\m@ne\let\XC@@xcp@\@tempa\fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \ifnum\@tempa=0 \AtBeginDvi{\special{header=xcolor.pro}}\fi
  \ifcase\XC@@xcf@
    \AtBeginDvi{\special{! XCfixnormalscale}}
  \fi
  \ifcase\XC@@xcp@
    \AtBeginDvi{\special{header=\jobname.xcp}}
    \newwrite\XC@@xcp\immediate\openout\XC@@xcp=\jobname.xcp
    \immediate\write\XC@@xcp{\@percentchar!}
    \immediate\write\XC@@xcp{TeXDict begin}
    \AtEndDocument
     {\immediate\write\XC@@xcp{end}\immediate\closeout\XC@@xcp}
  \fi
%    \end{macrocode}
%
% End of driver-specific part.
%    \begin{macrocode}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Required packages}
%
% All packages within the list |\XC@pkg|
% receive a pretended \LC.
%    \begin{macrocode}
\@namedef{ver@color.sty}{1999/02/16}
\XC@@pkg
%    \end{macrocode}
%
%
% \subsection{Macro tools}
%
% \subsubsection{General tools}
%
% \begin{macro}{\@secondoffive}
% \begin{macro}{\@thirdoffive}
% Argument grabbing, similar to \LaTeX{} kernel.
%    \begin{macrocode}
\long\def\@secondoffive#1#2#3#4#5{#2}
\long\def\@thirdoffive#1#2#3#4#5{#3}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xglobal}
% \begin{macro}{\xglobal@test}
% If |\foo| occurs in the token list |\xglobal@@|, then the command |\xglobal\foo| will set the switch |\xglobal@true| which can be used inside |\foo| to determine whether certain definitions are to be made explicitely global.
% |\foo| is responsible for resetting |\xglobal@false| in order to avoid side effects.
% To include |\foo| in the magic list, simply say |\XC@append\xglobal@list{\foo}|.
% If |\foo| is not in the list, |\xglobal\foo| will behave like |\global\foo|, thus |\xglobal\let| will be like |\global\let| etc.
%    \begin{macrocode}
\def\xglobal{\xglobal@stop\begingroup\futurelet\@@tok\xglobal@test}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\xglobal@test
 {\expandafter\@tfor\expandafter\@@tmp
   \expandafter:\expandafter=\xglobal@list\do
    {\expandafter\ifx\@@tmp\@@tok
       \aftergroup\let\aftergroup\xglobal@\@break@tfor\fi}%
  \endgroup\global}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xglobal@stop}
% Resetting |\xglobal@|.
%    \begin{macrocode}
\def\xglobal@stop{\let\xglobal@\@empty}
\xglobal@stop
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xglobal@list}
% Initial list of commands that may be prefixed by |\xglobal|.
%    \begin{macrocode}
\def\xglobal@list
 {\definecolor\definecolors\definecolorset\colorlet\providecolor
  \providecolors\providecolorset\blendcolors\maskcolors
  \substitutecolormodel}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xglobalize@}
% Globalisation command: makes a local definition global.
%    \begin{macrocode}
\def\xglobalize@#1{\ifx\xglobal@\global\global\let#1#1\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\GetGinDriver}
% Transforms the chosen driver option ready for \Package{hyperref}.
%    \begin{macrocode}
\def\GetGinDriver
 {\@tempswafalse
  \@tfor\@@tmp:={dvips}{luatex}{pdftex}{dvipdf}{dvipdfm}{dvipsone}{vtex}{textures}%
  \do{\ifx\XC@@drv\@@tmp\@tempswatrue\@break@tfor\fi}%
  \edef\GinDriver{\if@tempswa\XC@@drv\else hypertex\fi}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{String manipulation}
%
% \begin{macro}{\@hex@Hex}
%   \Meta{hex-string}|\relax|\\
% Converts \Meta{hex-string} to a string where all letters a--f are changed into their uppercase variants.
% All other letters are left unchanged.
% May be used inside |\edef|.
%    \begin{macrocode}
\def\@hex@Hex#1{\ifx#1\relax\else\expandafter\@hex@@Hex\expandafter#1\fi}
\def\@hex@@Hex#1%
 {\if a#1A\else \if b#1B\else \if c#1C\else \if d#1D\else
  \if e#1E\else \if f#1F\else #1\fi\fi\fi\fi\fi\fi \@hex@Hex}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@strip@comma}
%   \Meta[1]{string}|,|\Meta[2]{string}|,...,|\Meta[n]{string}|,,\@nnil|\\
% Converts a comma-separated list into a space-separated list.
% The evaluation stops at the first empty argument, skipping all remaining tokens until (and including) |\@nnil|.
% Thus, the list to be converted should always contain at least one `|,,|' sequence.
% May be used inside |\edef|.
%    \begin{macrocode}
\def\XC@strip@comma#1,#2%
 {\ifx,#2%
    #1\expandafter\remove@to@nnil\else#1 \expandafter\XC@strip@comma\fi
  #2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@replace}
%   \marg{cmd}\marg{search}\marg{replace}\\
% Replace all occurences of \meta{search} within the first-level expansion of \meta{cmd} by \meta{replace} and save the result in \meta{cmd}.
% The replacement is recursive, so don't put the search pattern into the replacement text!
% Note that this macro is incapable of seeing `into' braces.
% The code and its explanation is taken from \People{Donald}{Arseneau}'s \Package{url} package \cite{url}, with only minor changes and renamings applied.
% The original name of the game is |\Url@Edit|.
% Thanks to \People{Donald}{Arseneau} for giving me valuable hints.
%    \begin{macrocode}
{\catcode`Q=3
 \gdef\XC@replace#1#2#3%
  {\begingroup
%    \end{macrocode}
%
% If finished, then remove |\@empty|'s and redefine macro else, re-iterate.
%    \begin{macrocode}
   \def\XC@repl@ce##1#2##2Q##3%
    {\@ifxempty{##2}{\XC@r@pl@ce##1Q}{\XC@repl@ce##1##3##2Q{##3}}}%
   \def\XC@r@pl@ce##1\@empty Q%
    {\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{##1}}%
%    \end{macrocode}
%
% The leading |\@empty| preserves braces, as does the trailing pattern.
%    \begin{macrocode}
   \expandafter\XC@repl@ce\expandafter\@empty #1\@empty#2Q{#3}}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@clean}
%   \marg{cmd}\\
% Makes a proper comma-separated list from \meta{cmd}'s contents and stores it again in \meta{cmd}.
% Firstly, all commas are changed into spaces, secondly, `|. |' strings are changed to spaces.
% Thirdly, non-trailing spaces are turned into commas (using a technique similar to \LaTeX's |\zap@space|).
% Finally, the two leading commas are gobbled.
% For example, `| 1 2. ,  3 |' is mapped to `|1,2,3|'.
%    \begin{macrocode}
\def\XC@clean#1%
 {\edef#1{ #1 }%
  \XC@cle@n#1,{ }\XC@cle@n#1{. }{ }\XC@cle@n#1{ },%
  \edef#1{\expandafter\@gobbletwo#1}}
\def\XC@cle@n#1#2#3%
 {\def\XC@cl@@n##1#2##2{#3##1\ifx##2\@empty\else\expandafter\XC@cl@@n\fi##2}%
  \edef#1{\expandafter\XC@cl@@n#1#2\@empty}}%
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Scalar arithmetic}
%
% \begin{macro}{\rdivide}
%   \marg{dimension register}\marg{div}\\
% Divides \Meta{dimension register} by a real number \Meta{div}, which may also be buried in a dimension (register), and stores the resulting rounded dimension in \Meta{dimension register}.
% The denominator \Meta{div} is assumed to be non-zero.
%    \begin{macrocode}
\def\rdivide#1#2%
 {\begingroup\toks@{#1}\edef\@@tmp{\noexpand\@tempdima\the#1}%
  \@defaultunits\@tempdimb=#2pt\relax\@nnil \@@tmp\relax
  \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\def\@sign{-}\else
    \def\@sign{}\fi
  \ifdim\@tempdimb<\z@ \@tempdimb-\@tempdimb\edef\@sign{\@sign-}\fi
  \ifdim\@tempdima<.1\maxdimen \ifdim\@tempdimb<.01\maxdimen
    \lshift\@tempdima \lshift\@tempdimb \fi\fi
  \@tempcnta=\@tempdima \@tempcntb=\@tempdimb
  \count@=\@tempcnta \divide\count@\@tempcntb
  \edef\@@tmp{\number\count@.}%
  \@tempswatrue  \@rdivide \@rdivide \@rdivide \@rdivide \@rdivide
  \@tempswafalse \@rdivide
  \dimen@\@@tmp\p@ \ifnum\count@>4\advance\dimen@1sp\fi
  \dimen@\@sign\dimen@
  \edef\@@tmp{\the\toks@\the\dimen@}%
  \expandafter\endgroup\@@tmp}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@rdivide
 {\multiply\count@\@tempcntb \advance\@tempcnta-\count@
  \multiply\@tempcnta10 \count@=\@tempcnta \divide\count@\@tempcntb
  \if@tempswa\edef\@@tmp{\@@tmp\number\count@}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rmultiply}
%   \marg{dimension register}\marg{dec}\\
% Multiplies \Meta{dimension register} by \Meta{dec} and stores the resulting dimension in \Meta{dimension register}.
%    \begin{macrocode}
\def\rmultiply#1#2%
 {\begingroup
  \edef\@@mul{#2}\@tempdima\the#1\relax
  \afterassignment\@tempdimb\@tempcntb=\@@mul\p@
  \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\def\@sign{-}\else
    \def\@sign{}\fi
  \ifnum\@tempcntb<\z@ \@tempcntb-\@tempcntb\edef\@sign{\@sign-}\fi
  \lshift\@tempdima \dimen@\z@
  \expandafter\@rmultiply\@@mul.0.\@nil
  \advance\dimen@\@tempcntb\@tempdima \rshift\dimen@
  \dimen@\@sign\dimen@
  \edef\@@tmp{#1\the\dimen@}%
  \expandafter\endgroup\@@tmp}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@rmultiply#1.#2.#3\@nil
 {\def\@@tmp{}%
  \@tfor\@@mul:=#2\do
   {\edef\@@tmp
     {\advance\dimen@\@@mul\@tempdima \divide\dimen@10 \@@tmp}}%
  \@@tmp}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lshift}
% \begin{macro}{\llshift}
%   \marg{dimension register}\\
% Multiplies \Meta{dimension register} safely by 10 resp. 100.
%    \begin{macrocode}
\def\lshift#1{#1\expandafter\lshift@\the#1}
\def\llshift#1{\lshift#1\lshift#1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lshiftnum}
% \begin{macro}{\llshiftnum}
%   \marg{decimal number}\\
% Multiplies \Meta{decimal number} by 10 resp. 100.
%    \begin{macrocode}
\def\lshiftnum#1{\expandafter\lshiftnum@#1.00.:}
\def\lshiftnum@#1.#2#3.#4:{#1#2\ifnum0#3>\z@.#3\fi}
\def\llshiftnum#1{\expandafter\llshiftnum@#1\@empty.00.:}
\def\llshiftnum@#1.#2#3#4.#5:%
 {#1#2\ifnum0#3>\z@#3\else0\fi\ifnum0#4>\z@.#4\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lshiftset}
% \begin{macro}{\llshiftset}
%   \marg{dimension register}\marg{decimal number}\\
% Multiplies \Meta{decimal number} by 10 resp. 100 and puts it into \Meta{dimension register}.
%    \begin{macrocode}
\def\lshiftset#1#2{\edef\@@XC{\noexpand\lshiftnum{#2}}#1\@@XC\p@}
\def\llshiftset#1#2{\edef\@@XC{\noexpand\llshiftnum{#2}}#1\@@XC\p@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rshift}
% \begin{macro}{\rrshift}
%   \marg{dimension register}\\
% Divides \Meta{dimension register} safely by 10 resp. 100.
%    \begin{macrocode}
\def\rshift#1{#1\expandafter\rshift@\the#1}
\def\rrshift#1{\rshift#1\rshift#1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lshift}
% \begin{macro}{\llshift}
%   \marg{dec}\\
% Multiplies \Meta{dec}, which may be either a number or something like |\the\dimen@|, safely by 10 resp. 100.
% The following definitions are similar to the way how |\strip@pt| is defined in the \LaTeX{} kernel.
%    \begin{macrocode}
\begingroup
\catcode`P=12
\catcode`T=12
\lowercase
 {\def\@@tmp{\def\lshift@##1.##2##3PT{##1##2\ifnum0##3>\z@.##3\fi\p@}
             \def\rshift@##1.##2PT{\rshift@@##1\relax##2\p@}}}
\expandafter\endgroup\@@tmp
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\def\rshift@@#1#2%
 {\ifx#2\relax.#1\else#1\expandafter\rshift@@\expandafter#2\fi}
%    \end{macrocode}
%
%
% \subsubsection{Vector arithmetic}
%
% \begin{macro}{\XC@inflate}
%   \marg{core model}\marg{first}\marg{second}\marg{cmd}\\
% Constructs an 8-dimensional vector based on two vectors \Meta{first}, \Meta{second} (of common dimension $1,3,4$) and an underlying color model (stored in the macro \Meta{core model}).
% The resulting vector is stored in \Meta{cmd}.
%    \begin{macrocode}
\def\XC@inflate#1#2#3#4%
 {\edef#4{#2,\ifx#1\XC@mod@cmyk #3\else
             \ifx#1\XC@mod@gray ,,,#3,,,\else ,#3,\fi\fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@vec}
%   \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
% Generic vector calculation for two vectors (of common dimension $1,3,4$), puts the result into \Meta{cmd}.
%    \begin{macrocode}
\def\XC@vec#1,#2,#3,#4,#5,#6,#7,#8,#9%
 {\def\@@tmp{}%
  \XC@vec@{#1}{#5}%
  \ifx,#2,\else
  \XC@vec@{#2}{#6}\XC@vec@{#3}{#7}\ifx,#4,\else\XC@vec@{#4}{#8}\fi\fi
  \aftergroupdef#9\@@tmp}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@vec@@{\edef\@@tmp{\ifx\@@tmp\@empty\else\@@tmp,\fi\strip@pt\dimen@}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@add}
%   \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
% Calculates the sum of two vectors (of common dimension $1,3,4$) and puts it into \Meta{cmd}.
%    \begin{macrocode}
\def\XC@add{\begingroup \let\XC@vec@\XC@add@ \XC@vec}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@add@#1#2%
 {\llshiftset\dimen@{#1}\llshiftset\@tempdima{#2}%
  \advance\dimen@\@tempdima \rrshift\dimen@ \XC@vec@@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@sub}
%   \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
% Calculates the difference of two vectors (of common dimension $1,3,4$) and puts it into \Meta{cmd}.
%    \begin{macrocode}
\def\XC@sub{\begingroup \let\XC@vec@\XC@sub@ \XC@vec}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@sub@#1#2{\XC@add@{#1}{-#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@mul}
%   \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
% Calculates the (component-wise) product of two vectors (of common dimension $1,3,4$) and puts it into \Meta{cmd}.
%    \begin{macrocode}
\def\XC@mul{\begingroup \let\XC@vec@\XC@mul@ \XC@vec}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@mul@#1#2%
 {\llshiftset\dimen@{#1}\rmultiply\dimen@{#2}\rrshift\dimen@ \XC@vec@@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@mix}
%   \Meta{a}|,|\Meta{b}|,|\Meta{c}|,|\Meta{d}|,|\Meta{a'}|,|\Meta{b'}|,|\Meta{c'}|,|\Meta{d'}|,|\marg{cmd}\\
% Calculates the linear interpolation of two color parameter vectors and puts it into \Meta{cmd}.
% The percentage parameter $p$ is input via register |\dimen@|.
%    \begin{macrocode}
\def\XC@mix%
 {\begingroup
  \@tempdima\dimen@ \@tempdimb100\p@ \advance\@tempdimb-\@tempdima
  \let\XC@vec@\XC@mix@ \XC@vec}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@mix@#1#2%
 {\dimen@#1\@tempdima \advance\dimen@#2\@tempdimb \rrshift\dimen@ \XC@vec@@}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@calc@}
%   \Meta{x}|,|\Meta{y}|,|\Meta{z}|,|\Meta{w}|,|\Meta{dummy}|:|\marg{function}\\
% Performs, dependent on the number of non-empty parameters, |\edef\@@tmp{|$f(x)$|}| or |\edef\@@tmp{|$f(x),f(y),f(z)$|}| or |\edef\@@tmp{|$f(x),f(y),f(z),f(w)$|}|, where the function $f$ is determined by the parameter \Meta{function}.
%    \begin{macrocode}
\def\XC@calc@#1,#2,#3,#4,#5:#6%
 {\XC@let@Nc\@@cmd{XC@calc#6}\@@cmd{#1}\@@tmp
  \ifx,#2,\else
    \@@cmd{#2}\@tempa\@@cmd{#3}\@tempb
    \ifx,#4,%
      \edef\@@tmp{\@@tmp,\@tempa,\@tempb}\else
      \@@cmd{#4}\@tempc\edef\@@tmp{\@@tmp,\@tempa,\@tempb,\@tempc}\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcC}
%   \marg{x}\marg{cmd}\\
% \textbf Complement of $x$: performs |\def|\Meta{cmd}|{|$1-x$|}|.
% Yields exact results for all numbers within $[0,1]$ with 5 decimal digits.
%    \begin{macrocode}
\def\XC@calcC#1#2%
 {\llshiftset\dimen@{-#1}\advance\dimen@100\p@
  \rrshift\dimen@ \XC@calcN{\strip@pt\dimen@}#2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcD}
%   \marg{x}\marg{cmd}\\
% \textbf Division of $x$ by $s$: performs |\def|\Meta{cmd}|{|$x/s$|}|.
% The parameter $s$ is input via |\@@scl|.
%    \begin{macrocode}
\def\XC@calcD{\XC@c@lcD\@@scl{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@c@lcD}
%   \marg{s}\marg{string}\marg{x}\marg{cmd}\\
% \textbf Division of $x$ by $s$, appending \Meta{string}: performs |\def|\Meta{cmd}|{|$x/s$\Meta{string}|}|.
%    \begin{macrocode}
\def\XC@c@lcD#1#2#3#4%
 {\dimen@#3\p@ \rdivide\dimen@{#1}\edef#4{\strip@pt\dimen@#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcF}
%   \marg{x}\marg{cmd}\\
% \textbf Format $x$ with 5 decimals, no range checks.
%    \begin{macrocode}
\def\XC@calcF#1#2%
 {\edef#2{#1}\expandafter\XC@c@lcF#2.0.:#2}
%    \end{macrocode}
%
% Special treatment of integer part because of so many possible variations ($---.0$, $7$, \dots).
%    \begin{macrocode}
\def\XC@c@lcF#1.#2.#3:#4%
 {\edef#4{\XC@c@@cR#200000:}%
  \dimen@#1.5\p@ \afterassignment\dimen@\count@=\the\dimen@
  \edef#4%
   {\ifnum#4>0 \ifnum\count@=0 \ifdim#1.5\p@<\z@ -\fi\fi\fi
    \number\count@.#4}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcH}
%   \marg{x}\marg{cmd}\\
% \textbf Hexadecimal transformation of $x\in\{0,1,\dots,255\}$: performs |\def|\Meta{cmd}|{|$x_{16}$|}|.
%    \begin{macrocode}
\def\XC@calcH#1#2%
 {\count@#1 \divide\count@\sixt@@n \edef\XC@@tmp{\hexnumber@\count@}%
  \multiply\count@-\sixt@@n \advance\count@#1
  \edef#2{\XC@@tmp\hexnumber@\count@}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcM}
%   \marg{x}\marg{cmd}\\
% \textbf Multiplication of $x$ by $s$ plus rounding: performs |\def|\Meta{cmd}|{|$[s\cdot x+0.5]$|}|.
% The parameter $s$ is input via |\@@scl|.
%    \begin{macrocode}
\def\XC@calcM#1#2%
 {\dimen@#1\p@ \dimen@\@@scl\dimen@ \advance\dimen@.5\p@
  \afterassignment\dimen@\count@=\the\dimen@ \edef#2{\number\count@}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcN}
%   \marg{x}\marg{cmd}\\
% \textbf Normalisation of $x$: similar to |\XC@calcR|, but trailing zeros are eliminated.
%    \begin{macrocode}
\def\XC@calcN#1#2%
 {\XC@calcR{#1}#2\edef#2{\expandafter\XC@c@lcN#200000:}}
%    \end{macrocode}
%
% Gobble trailing zeros.
%    \begin{macrocode}
\def\XC@c@lcN#1.#200000#3:{#1\ifnum0#2=0 \else.#2\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcR}
%   \marg{x}\marg{cmd}\\
% \textbf Reduction of $x$ to the unit interval: performs |\def|\Meta{cmd}|{|$\min\{1,\max\{0,x\}\}$|}|.
% Numbers are output with 5 decimals.
% This could also be done using |\XC@calcF|, followed by a range check, but perhaps less efficiently.
%    \begin{macrocode}
\def\XC@calcR#1#2{\edef#2{#1}\edef#2{\expandafter\XC@c@lcR#2.0.:}}
%    \end{macrocode}
%
% Check interval.
%    \begin{macrocode}
\def\XC@c@lcR#1.#2.#3:%
 {\ifnum#10>0 1.00000\else 0.\ifnum#11<0 00000\else
  \XC@c@@cR#200000:\fi\fi}
%    \end{macrocode}
%
% Normalize to 5 digits.
%    \begin{macrocode}
\def\XC@c@@cR#1#2#3#4#5#6:{#1#2#3#4#5}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcS}
%   \marg{x}\marg{cmd}\\
% \textbf Scaling of $x$ by $s$: performs |\def|\Meta{cmd}|{|$s\cdot x$|}|.
% The parameter $s$ is input via |\@@scl|.
%    \begin{macrocode}
\def\XC@calcS{\XC@c@lcS\@@scl{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@c@lcS}
%   \marg{s}\marg{string}\marg{x}\marg{cmd}\\
% \textbf Scaling of $x$ by $s$, appending \Meta{string}: performs |\def|\Meta{cmd}|{|$s\cdot x$\Meta{string}|}|.
%    \begin{macrocode}
\def\XC@c@lcS#1#2#3#4%
 {\lshiftset\dimen@{#3}%
  \ifdim#1\p@<100\p@
    \dimen@\lshiftnum#1\dimen@ \rrshift\dimen@ \else
    \dimen@#1\dimen@ \rshift\dimen@ \fi
  \edef#4{\strip@pt\dimen@#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcT}
%   \marg{x}\marg{cmd}\\
% \textbf Translate $x$ by $a$ and cut to unit interval: performs |\def|\Meta{cmd}|{|$\min\{1,\max\{0,x+a\}\}$|}|.
% The parameter $a$ is input via |\@@arg|.
%    \begin{macrocode}
\def\XC@calcT#1#2%
 {\lshiftset\dimen@{#1}\advance\dimen@\lshiftnum\@@arg\p@ \rshift\dimen@
  \edef#2%
   {\ifdim\dimen@>\p@1\else\ifdim\dimen@<\z@0\else\strip@pt\dimen@\fi\fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@calcU}
%   \marg{x}\marg{cmd}\\
% \textbf Unit interval mapping of $x$: performs |\def|\Meta{cmd}|{|$x-[x]$|}| if $x\neq1$, $1$ otherwise.
%    \begin{macrocode}
\def\XC@calcU#1#2%
 {\dimen@#1\p@
  \ifdim\dimen@=\p@\else
    \afterassignment\dimen@\count@=\the\dimen@
    \relax\ifdim\dimen@=\z@\else
      \ifdim#1\p@<\z@ \dimen@-\dimen@ \advance\dimen@\p@ \fi
    \fi
  \fi
  \edef#2{\strip@pt\dimen@}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Color definition}
%
% \subsubsection{Constants}
%
% \begin{macro}{\rangeRGB}
% \begin{macro}{\rangeHSB}
% \begin{macro}{\rangeHsb}
% \begin{macro}{\rangetHsb}
% \begin{macro}{\rangeGray}
% Scaling ranges for `integer' and other special models:
%    \begin{macrocode}
\providecommand*\rangeRGB{255}
\providecommand*\rangeHSB{240}
\providecommand*\rangeHsb{360}
\providecommand*\rangetHsb{60,30;120,60;180,120;210,180;240,240}
\providecommand*\rangeGray{15}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\adjustUCRBG}
% Parameters for undercolor-removal (UCR) and black-generation (BG) during \Model{cmy} to \Model{cmyk} conversion:
%    \begin{macrocode}
\providecommand*\adjustUCRBG{1,1,1,1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\paperquality}
% Parameter for choosing different color sets according to the paper quality; yet supported only for the HKS colors.
%    \begin{macrocode}
\providecommand*\paperquality{1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\colorseriescycle}
% Default cycle length for color series:
%    \begin{macrocode}
\providecommand*\colorseriescycle{16}
%    \end{macrocode}
% \end{macro}
%
% Model-dependent base colors:
%    \begin{macrocode}
\def\XC@clr@rgb@white{1,1,1}
\def\XC@clr@cmy@white{0,0,0}
\def\XC@clr@cmyk@white{0,0,0,0}
\def\XC@clr@hsb@white{\@@hue,0,1}
\def\XC@clr@hsb@gray{\@@hue,0,0.5}
\def\XC@clr@hsb@black{\@@hue,0,0}
\def\XC@clr@gray@white{1}
%    \end{macrocode}
%
% \begin{macro}{\XC@met@grad}
% \begin{macro}{\XC@met@last}
% \begin{macro}{\XC@met@step}
% Methods for color series:
%    \begin{macrocode}
\@tfor\@@tmp:={grad}{last}{step}\do
 {\XC@let@cN{XC@met@\@@tmp}\@@tmp}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Colors}\label{sec.definition}
%
% \begin{macro}{\definecolor}
%   \oarg{type}\marg{name}\oarg{prefix}\marg{model-list}\marg{spec-list}\\
% Extends the facilities of \LC's |\definecolor|.
% The optional argument \Meta{type} has currently to be either empty (= normal color definition) or `named' or `ps'.
% \Meta{prefix} is an argument used for the internal driver-dependent representation.
% |\definecolor| creates a new command |\\color@|\Meta{name} that contains the \emph{internal representation}
% |\xcolor@|\marg{type-spec}\marg{driver-spec}\marg{n-model}\marg{n-color-spec} of the color, where
% \begin{itemize}
% \item \Meta{type-spec} is either empty (if \Meta{type} was empty), or a driver-dependent macro or expression (if \Meta{type} was `named', `ps');
% \item \Meta{driver-spec} is a driver-dependent representation of the color, which also depends on \Meta{type};
% \item \Meta{n-model} is either \Meta{model} or the name of another color model, dependent on the desired transformation(s) at definition time;
% \item \Meta{n-color-spec} are the comma-separated normalised parameter values of the color with respect to \Meta{n-model}.
% \end{itemize}
% See table \vref{tab.internal} for some examples.
%    \begin{macrocode}
\def\definecolor{\@testopt{\XC@definecolor}{}}
\def\XC@definecolor[#1]#2%
 {\@testopt{\XC@definec@lor[#1]{#2}}\colornameprefix}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definec@lor[#1]#2[#3]#4#5%
 {\begingroup
  \XC@sdef\@@cls{#1}\XC@edef\@@nam{#2}\edef\colornameprefix{#3}%
  \XC@logdef\@@nam
  \XC@getmodclr02{#4}{#5}{\let\@@tmp\relax}%
   {\ifx\@@mod\XC@mod@named
      \XC@c@l@rlet\@@nam\@@clr
    \else
      \ifx\@@cls\XC@mod@ps
        \edef\@@drv{\@@mod\space\@@clr}\def\@@hue{0}%
        \edef\@@clr{\@nameuse{XC@clr@\@@mod @white}}%
      \else
        \ifconvertcolorsD
          \let\@@tmp\@@mod\XC@sdef\@@mod{\XC@tgt@mod\@@tmp}%
          \convertcolorspec\@@tmp\@@clr\@@mod\@@clr
        \fi
        \XC@coremodel\@@mod\@@clr
%    \end{macrocode}
%
% Determine driver-dependent color definition:
%    \begin{macrocode}
        \csname color@\@@mod\expandafter\endcsname
          \expandafter\@@drv\expandafter{\@@clr}%
%    \end{macrocode}
%
% Handle prologue and `named' colors:
%    \begin{macrocode}
        \ifcase\XC@@xcp@
          \immediate\write\XC@@xcp{/\colornameprefix\@@nam{\expandafter
            \XC@strip@comma\@@clr,,\@nnil}XC\@@mod}%
          \let\@@cls\XC@mod@named
        \fi
        \ifx\@@cls\@empty\else
          \let\@@tmp\@@cls
          \@nameuse{define@color@\@@cls}\@@nam\@@drv
          \csname color@\@@tmp\expandafter\endcsname
            \expandafter\@@drv\expandafter{\@@nam}%
        \fi
      \fi
%    \end{macrocode}
%
% Finally write all information into macro |\\color@|\Meta{name}:
%    \begin{macrocode}
      \toks@\expandafter{\@@drv}%
      \edef\@@tmp
       {\ifglobalcolors\global\else\xglobal@\fi
        \noexpand\@namedef{\string\color@\@@nam}%
         {\noexpand\xcolor@{\@@cls}{\the\toks@}{\@@mod}{\@@clr}}}%
    \fi}%
  \expandafter\endgroup\@@tmp\xglobal@stop}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@getmodclr}
%   \marg{mod-opt}\marg{clr-opt}\marg{model-list}\marg{spec-list}\marg{undefined}\marg{defined}\\
% Depending on \Meta{mod-opt}, different tasks are performed:
% \begin{itemize}
% \item[0:] Retrieve color model and target model from \Meta{model-list} if |\XC@@getmod| is `true'.
% \item[1:] Retrieve color model and target model from \Meta{model-list} always.
% \end{itemize}
% The color model is stored in |\@@mod|, its position in |\XC@@pos|, a possible target model in |\@@Mod|.
% Depending on \Meta{clr-opt}, different tasks are performed:
% \begin{itemize}
% \item[0:] Don't pick color specification from \Meta{spec-list}.
% \item[1:] Pick color specification from \Meta{spec-list}, convert it from model |\@@mod| to |\@@Mod|, unless the latter is `ignore' or |\@@cls| is `ps'.
% \item[2:] Like the former case, additionally |\let\@@mod\@@Mod|.
% \end{itemize}
% The color specification is stored in |\@@clr|.
% Color specification picking relies on the position |\XC@@pos|, conversion relies on the model |\@@mod|, and the target model |\@@Mod|.
% If |\@@mod| represents an undefined color model, then \Meta{undefined} is executed at the end of the macro, else \Meta{defined}.
%    \begin{macrocode}
\def\XC@getmodclr#1#2#3#4%
 {\ifnum\ifcase#1 \ifXC@@getmod1\else0 \fi \or1 \fi>0
    \XC@mdef\@@mod{#3}\expandafter\XC@getmod\@@mod////////\XC@@
    \@ifundefinedmodel\@@Mod{\let\@@Mod\XC@mod@ignore}{}\fi
  \@ifundefined{XC@mod@\@@mod}%
   {\c@lor@error{model `\@@mod'}\@firstoftwo}%
   {\ifcase#2\else
      \XC@mdef\@@clr{#4}%
      \edef\@@clr{\expandafter\XC@getclr\@@clr////////\XC@@}%
      \ifx\@@cls\XC@mod@ps\else\XC@clean\@@clr\fi
      \ifx\@@Mod\XC@mod@ignore\else
        \convertcolorspec\@@mod\@@clr\@@Mod\@@clr
        \ifnum#2>1 \let\@@mod\@@Mod\fi
      \fi
    \fi \@secondoftwo}}
%    \end{macrocode}
%
% \begin{macro}{\XC@getmod}
% Retrieve model position |\XC@@pos|, model |\@@mod|, and target model |\@@Mod| from multiple definitions (up to~8), separated by `|/|'.
%    \begin{macrocode}
\def\XC@getmod#1/#2/#3/#4/#5/#6/#7/#8/#9\XC@@
 {\XC@g@tm@d0#1::\XC@@ \XC@getm@d1{#2}\XC@getm@d2{#3}%
  \XC@getm@d3{#4}\XC@getm@d4{#5}\XC@getm@d5{#6}\XC@getm@d6{#7}%
  \XC@getm@d7{#8}\def\XC@@pos{0}\def\@@mod{#1}\@gobble\@nnil}%
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@getm@d#1#2%
 {\edef\XC@@pos{#2}\XC@sdef\@@mod{\XC@tgt@mod\XC@@pos}%
  \ifx\XC@@pos\@@mod\def\XC@@pos{#1}\expandafter\remove@to@nnil\fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@g@tm@d#1#2:#3:#4\XC@@
 {\@ifxempty{#3}{\let\@@Mod\XC@mod@ignore\XC@getm@d0{#2}}%
    {\def\@@Mod{#2}\XC@getm@d0{#3}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@getclr}
% Pick color specification on position |\XC@@pos| from multiple definitions (up to~8), separated by `|/|'.
% Expandable.
%    \begin{macrocode}
\def\XC@getclr#1/#2/#3/#4/#5/#6/#7/#8/#9\XC@@
 {\ifcase\XC@@pos\space #1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifXC@@getmod}
% Switch used to determine whether the model has to be retrieved (e.g., ordinary |\definecolor|) or not (e.g., |\definecolor| acting as subroutine to |\definecolorset|).
%    \begin{macrocode}
\newif\ifXC@@getmod \XC@@getmodtrue
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xdefinecolor}
% This command is identical with |\definecolor|, it is kept only for compatibility reasons.
%    \begin{macrocode}
\let\xdefinecolor\definecolor
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\providecolor}
%   \oarg{type}\marg{name}\marg{model-list}\marg{spec-list}\\
% Similar to |\definecolor|, but the color \Meta{name} is only defined if it does not exist already.
%    \begin{macrocode}
\def\providecolor{\@testopt{\XC@providecolor}{}}
\def\XC@providecolor[#1]#2%
 {\@testopt{\XC@providec@lor[#1]{#2}}\colornameprefix}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@providec@lor[#1]#2[#3]%
 {\XC@edef\XC@@tmp{#2}%
  \@ifundefinedcolor\XC@@tmp{\XC@definecolor[#1]{#2}[#3]}%
   {\ifnum\XC@tracing>0
      \PackageInfo{xcolor}{Ignoring color definition `\XC@@tmp'}\fi
    \@gobbletwo}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xcolor@}
%   \marg{type-spec}\marg{driver-spec}\marg{model}\marg{spec}\\
% Simply grabs the driver-specific part of the color definition.
% Therefore, the command |\\color@|\Meta{name} behaves like in the original case, when first-level expanded.
%    \begin{macrocode}
\def\xcolor@#1#2#3#4{#2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\colorlet}
%   \oarg{type}\marg{name}\oarg{num model}\marg{color}\\
% Create a color `name' consisting of \Meta{color}, converted to \Meta{num model} if non-empty.
%    \begin{macrocode}
\def\colorlet{\@testopt{\XC@colorlet}{}}
\def\XC@colorlet[#1]#2{\@testopt{\XC@col@rlet[#1]{#2}}{}}
\def\XC@col@rlet[#1]#2[#3]#4%
 {\begingroup
  \edef\@@cls{#1}\XC@edef\@@nam{#2}\XC@sdef\@@mod{#3}\XC@edef\@@clr{#4}%
%    \end{macrocode}
%
% Check whether |#4| is an explicit name, |#3| is empty and |#1| is either empty or equal to the corresponding parameter of |#4|: in this case, a simple |\let| command will do the job.
%    \begin{macrocode}
  \XC@info\@@clr\@@tmp\XC@@tstfalse
  \ifnum\@@tmp=\@ne\ifx\@@mod\@empty
    \ifx\@@cls\@empty
      \XC@@tsttrue
    \else
      \edef\@@tmp
       {\expandafter\expandafter\expandafter\@secondoffive
         \csname\string\color@\@@clr\endcsname}%
      \ifx\@@cls\@@tmp\XC@@tsttrue\fi
    \fi
  \fi\fi
  \ifXC@@tst
    \XC@logdef\@@nam\XC@c@l@rlet\@@nam\@@clr
  \else
    \extractcolorspec\@@clr\@@clr
    \ifx\@@mod\@empty\else
      \expandafter\convertcolorspec\@@clr\@@mod\@@clr
      \edef\@@clr{{\@@mod}{\@@clr}}\fi
    \edef\@@tmp{\noexpand\XC@definecolor[\@@cls]{\@@nam}\@@clr}%
  \fi
  \expandafter\endgroup\@@tmp\xglobal@stop}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@c@l@rlet#1#2%
 {\@ifundefinedcolor{#2}%
   {\c@lor@error{`#2'}\let\@@tmp\@empty}%
   {\edef\@@tmp
     {\ifglobalcolors\global\else\xglobal@\fi
      \noexpand\XC@let@cc{\string\color@#1}{\string\color@#2}}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DefineNamedColor}
%   \marg{type}\marg{name}\marg{model-list}\marg{spec-list}
%    \begin{macrocode}
\def\DefineNamedColor#1%
 {\@nameuse{XC@\ifdefinecolors defin\else prepar\fi ecolor}[#1]}
%    \end{macrocode}
%  \end{macro}
%
%
% \subsubsection{Deferred definition}
%
% \begin{macro}{\preparecolor}
%   \oarg{type}\marg{name}\oarg{prefix}\marg{model-list}\marg{spec-list}\\
%    \begin{macrocode}
\def\preparecolor{\@testopt{\XC@preparecolor}{}}
\def\XC@preparecolor[#1]#2%
 {\@testopt{\XC@preparec@lor[#1]{#2}}\colornameprefix}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@preparec@lor[#1]#2[#3]#4#5%
 {\XC@sdef\@@cls{#1}\XC@edef\@@nam{#2}%
  \XC@getmodclr01{#4}{#5}{}%
   {\xdef\XC@@stack
     {\ifx\XC@@stack\@empty\else\XC@@stack,\fi{#1}{\@@nam}{#3}%
      {\ifx\@@Mod\XC@mod@ignore\@@mod\else\@@Mod\fi}{\@@clr}}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\XC@@stack\@empty
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\definecolors}
%   \marg{id-list}
%    \begin{macrocode}
\def\definecolors#1%
 {\let\XC@@cmd\definecolor\let\XC@@glb\xglobal@
  \expandafter\XC@definecolors#1,,}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definecolors#1,%
 {\@ifxempty{#1}{}{\expandafter\XC@definec@lors#1=#1=:\XC@definecolors}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definec@lors#1=#2=#3:%
 {\XC@edef\@@nam{#1}\XC@edef\@@arg{#2}%
  \let\next\XC@definec@l@rs\expandafter\next\XC@@stack,,\@nnil}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definec@l@rs#1,%
 {\ifx,#1,\let\next\remove@to@nnil\else\XC@defin@c@l@rs#1\fi\next}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@defin@c@l@rs#1#2#3#4#5%
 {\def\@@tmp{#2}%
  \ifx\@@tmp\@@arg
    \let\xglobal@\XC@@glb\XC@@cmd[#1]{\@@nam}[#3]{#4}{#5}%
    \let\next\remove@to@nnil
  \fi}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\providecolors}
%   \marg{id-list}\\
% Similar to |\definecolor|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
%    \begin{macrocode}
\def\providecolors#1%
 {\let\XC@@cmd\providecolor\let\XC@@glb\xglobal@
  \expandafter\XC@definecolors#1,,}
%    \end{macrocode}
%  \end{macro}
%
%
% \subsubsection{Sets of colors}
%
% \begin{macro}{\definecolorset}
%   \oarg{type}\marg{model-list}\marg{head}\marg{tail}\marg{set spec}\\
% This command facilitates the construction of \emph{color sets} with common underlying \Meta{model-list} and \Meta{type}.
% Here, \Meta{set spec} = \Meta[1]{name},\Meta[1]{spec-list};\dots;\Meta[k]{name},\Meta[k]{spec-list} ($k\ge1$ name/specification-list pairs).
% Individual colors are being constructed by |\definecolor|\oarg{type}|{|\Meta{head}\Meta[1]{name}\Meta{tail}|}|\marg{model-list}|{|\Meta[1]{spec-list}|}| etc.
%    \begin{macrocode}
\def\definecolorset
 {\let\XC@@cmd\definecolor\@testopt{\XC@definecolorset}{}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definecolorset[#1]#2#3#4#5%
 {\XC@getmodclr10{#2}{}{}%
   {\XC@@getmodfalse\XC@edef\XC@@tmp{#5}\let\XC@@glb\xglobal@
    \def\XC@definec@lorset##1,##2;%
     {\@ifxempty{##1}{}%
       {\let\xglobal@\XC@@glb
        \XC@@cmd[#1]{#3##1#4}{\@@mod}{##2}\XC@definec@lorset}}%
    \expandafter\XC@definec@lorset\XC@@tmp;,;\XC@@getmodtrue}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\providecolorset}
%   \oarg{type}\marg{model-list}\marg{name-prefix}\marg{name-postfix}\marg{set spec}\\
% Similar to |\definecolorset|, but based on |\providecolor|, thus the individual colors are defined only if they do not exist already.
%    \begin{macrocode}
\def\providecolorset
 {\let\XC@@cmd\providecolor\@testopt{\XC@definecolorset}{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\preparecolorset}
%   \oarg{type}\marg{model-list}\marg{name-prefix}\marg{name-postfix}\marg{set spec}\\
% Similar to |\definecolorset|, but dependent on |\ifdefinecolors|, either a |\definecolor| or a |\preparecolor| command will be executed for each single set member.
%    \begin{macrocode}
\def\preparecolorset
 {\ifdefinecolors\let\XC@@cmd\definecolor\else\let\XC@@cmd\preparecolor\fi
  \@testopt{\XC@definecolorset}{}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Color series}
%
% \begin{macro}{\definecolorseries}
%   \marg{name}\marg{core model}\marg{method}\oarg{b-model}\marg{base color}\oarg{l-model}\marg{delta}
%    \begin{macrocode}
\def\definecolorseries#1#2#3%
 {\@testopt{\XC@definecolorseries{#1}{#2}{#3}}{}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definecolorseries#1#2#3[#4]#5%
 {\@testopt{\XC@definec@lorseries{#1}{#2}{#3}[#4]{#5}}{}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@definec@lorseries#1#2#3[#4]#5[#6]#7%
 {\begingroup
  \XC@sdef\@@mod{#2}%
  \@ifxempty{#4}{\extractcolorspec{#5}\@@clr}{\edef\@@clr{{#4}{#5}}}%
  \expandafter\convertcolorspec\@@clr\@@mod\@@clr
  \@namexdef{\string\colorB@#1}{{\@@mod}{\@@clr}}%
  \edef\@@met{#3}%
  \ifx\@@met\XC@met@last
    \@ifxempty{#6}{\extractcolorspec{#7}\@@tmp}{\edef\@@tmp{{#6}{#7}}}%
    \expandafter\convertcolorspec\@@tmp\@@mod\@@tmp
    \XC@inflate\@@mod\@@tmp\@@clr\@@tmp
    \expandafter\XC@sub\@@tmp,\@@tmp
  \else
    \edef\@@tmp{#7}%
  \fi
  \@namexdef{\string\colorD@#1}{{\@@met}{\@@tmp}}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\resetcolorseries}
%   \oarg{div}\marg{name}
%    \begin{macrocode}
\def\resetcolorseries{\@testopt{\XC@resetcolorseries}{}}
\def\XC@resetcolorseries[#1]#2%
 {\begingroup
  \@namexdef
   {\string\color@#2}{\noexpand\xcolor@{}{}\@nameuse{\string\colorB@#2}}%
  \XC@let@Nc\@@tmp{\string\colorD@#2}%
  \edef\@@met{\expandafter\@firstoftwo\@@tmp}%
  \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
  \ifx\@@met\XC@met@step\else
    \edef\@@scl{\@ifxempty{#1}\colorseriescycle{#1}}%
    \expandafter\XC@calc@\@@tmp,,,,:D%
  \fi
  \@namexdef{\string\colorS@#2}{\@@tmp}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@step}
% \begin{macro}{\XC@stepabs}
%   \marg{name}\\
% Perform a relative or absolute (= direct access) step within a color series \Meta{name}.
% In the relative case, the (non-negative) number of single steps is supposed to be stored in |\@tempcnta|.
%    \begin{macrocode}
\def\XC@step#1%
 {\let\xcolor@\@gobbletwo\edef\@@tmp{\@nameuse{\string\color@#1}}%
  \expandafter\XC@st@p\@@tmp{#1}%
  \@namexdef{\string\color@#1}{\noexpand\xcolor@{}{}{\@@mod}{\@@tmp}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@st@p#1#2#3%
 {\def\@@mod{#1}\def\@@tmp{#2}\edef\@@vec{\@nameuse{\string\colorS@#3}}%
  \@whilenum\@tempcnta>\z@\do
   {\XC@inflate\@@mod\@@tmp\@@vec\@@tmp
    \expandafter\XC@add\@@tmp,\@@tmp \expandafter\XC@calc@\@@tmp,,,,:U%
    \advance\@tempcnta\m@ne}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@stepabs#1%
 {\edef\@@tmp{\@nameuse{\string\colorB@#1}}%
  \expandafter\XC@st@p\@@tmp{#1}%
  \edef\@@tmp
   {\def\noexpand\@@mod{\@@mod}\def\noexpand\@@clr{\@@tmp}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Color blending}
%
% \begin{macro}{\blendcolors}
% \begin{macro}{\blendcolors*}
%   \marg{mix expr}\\
% Initialises all necessary parameters for color blending.
% The actual (completed) color blend expression is stored in |\colorblend|.
% In the starred version, the argument will be appended to a previously defined blend expression.
% An empty \Meta{mix expr} argument will switch blending off.
%    \begin{macrocode}
\def\blendcolors{\@ifstar{\XC@blendcolors\colorblend}{\XC@blendcolors{}}}
\def\XC@blendcolors#1#2%
 {\edef\colorblend{#1}\XC@edef\XC@@tmp{#2}%
  \ifx\XC@@tmp\@empty
    \xglobal@\blendcolorsfalse
  \else
    \xglobal@\blendcolorstrue
    \expandafter\XC@blendc@lors\XC@@tmp!!\@nil
  \fi
  \xglobalize@\colorblend \xglobal@stop}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@blendc@lors!#1!#2!#3\@nil
 {\@ifxempty{#1}{}%
   {\@ifxempty{#2}%
    {\edef\colorblend{\colorblend!#1!white}}%
    {\edef\colorblend{\colorblend!#1!#2}\XC@blendc@lors!#3!\@nil}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\blendcolors{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Color masks and separation}
%
% \begin{macro}{\maskcolors}
%   \oarg{core model}\marg{color}\\
% Initialises all necessary parameters for color masking.
% The actual color mask expression is stored in |\colormask|.
% An empty \Meta{color} argument will switch masking off.
% The optional \Meta{core model} argument may be used to determine the underlying color model.
%    \begin{macrocode}
\def\maskcolors{\@testopt{\XC@maskcolors}{}}
\def\XC@maskcolors[#1]#2%
 {\XC@edef\colormask{#2}%
  \ifx\colormask\@empty
    \xglobal@\maskcolorsfalse \def\XC@mmod{}\def\XC@mclr{}%
  \else
    \xglobal@\maskcolorstrue \extractcolorspecs\colormask\XC@mmod\XC@mclr
    \@ifxempty{#1}{}%
     {\convertcolorspec\XC@mmod\XC@mclr{#1}\XC@mclr \XC@sdef\XC@mmod{#1}}%
    \XC@coremodel\XC@mmod\XC@mclr
  \fi
  \xglobalize@\colormask \xglobalize@\XC@mmod \xglobalize@\XC@mclr
  \xglobal@stop}
%    \end{macrocode}
%
%    \begin{macrocode}
\maskcolors{}
%    \end{macrocode}
% \end{macro}
%
%
%
% \subsection{Color application}
%
% \subsubsection{Standard color commands}
%
%  \begin{macro}{\color}
%   \marg{color}\\
%   \oarg{model-list}\marg{spec-list}\\
% Switches to the color given either by name/expression or by model/specification.
% This color will stay in effect until the end of the current \TeX\ group.
%    \begin{macrocode}
\DeclareRobustCommand\color
 {\@ifnextchar[\@undeclaredcolor\@declaredcolor}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\@undeclaredcolor}
%   \oarg{model-list}\marg{spec-list}\\
% Display a color that is given by \Meta{model} name and numerical \Meta{spec}.
%    \begin{macrocode}
\def\@undeclaredcolor[#1]#2%
 {\begingroup
  \let\@@cls\@empty
  \XC@getmodclr12{#1}{#2}{}%
   {\ifblendcolors
      \ifx\colorblend\@empty\else
        \edef\@@mix{\expandafter\@gobble\colorblend}\@tempswafalse
        \XC@coremodel\@@mod\@@clr\@xcolor@{}{}\@@mod\@@clr
      \fi
    \fi
    \ifconvertcolorsU
      \edef\@@tmp{\XC@tgt@mod{\@@mod}}%
      \convertcolorspec\@@mod\@@clr\@@tmp\@@clr \let\@@mod\@@tmp
    \fi
    \ifmaskcolors
      \convertcolorspec\@@mod\@@clr\XC@mmod\@@clr
      \let\@@mod\XC@mmod
      \XC@inflate\@@mod\XC@mclr\@@clr\@@tmp
      \expandafter\XC@mul\@@tmp,\@@clr
    \fi
    \edef\@@tmp{\noexpand\XC@undeclaredcolor{\@@mod}{\@@clr}}%
    \expandafter\endgroup\@@tmp}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@undeclaredcolor#1#2%
 {\@ifundefinedmodel{#1}%
   {\c@lor@error{model `#1'}}%
   {\@nameuse{color@#1}\current@color{#2}%
    \edef\XC@current@color{\noexpand\xcolor@{}{\current@color}{#1}{#2}}%
    \XC@display}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@declaredcolor}
%   \marg{color}\\
% Display a color that is given by an arbitrary \Meta{color}.
%    \begin{macrocode}
\def\@declaredcolor#1%
 {\XC@edef\XC@@tmp{#1}\XC@@tstfalse
  \ifcase\XC@type\XC@@tmp\relax \XC@@tsttrue\or \relax\else
    \ifblendcolors\XC@@tsttrue\fi \ifmaskcolors\XC@@tsttrue\fi
    \ifconvertcolorsU\XC@@tsttrue\fi
  \fi
  \ifXC@@tst
    \expandafter\XC@declaredcolor\else
    \expandafter\XC@declaredc@lor\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@declaredcolor
 {\XC@split\XC@@tmp
  \edef\@@tmp{\noexpand\@undeclaredcolor[\@@mod]{\@@clr}}%
  \expandafter\endgroup\@@tmp}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@declaredc@lor
 {\XC@let@Nc\XC@current@color{\string\color@\XC@@tmp}%
  \edef\current@color{\XC@current@color}%
  \XC@display}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\textcolor}
%   \marg{color}\marg{text}\\
%   \oarg{model-list}\marg{spec-list}\marg{text}\\
% are just alternative syntax for |\color|, in which the groups are added implicitly.
% Thus \emph{text} appears in the specified color, but then the color reverts to its previous value.
% The naming is by analogy with |\textrm| (as opposed to |\rm| and |\rmfamily|) although it is slightly a misnomer as the command also works in math-mode.
% Additionally, it calls |\leavevmode| to ensure the start of horizontal mode.
%    \begin{macrocode}
\def\textcolor#1#{\@textcolor{#1}}
\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\pagecolor}
%   \marg{color}\\
%   \oarg{model-list}\marg{spec-list}\\
% Specifies the background color for the current, and all following, pages.
% It is a global declaration which does not respect \TeX\ groups.
%    \begin{macrocode}
\def\pagecolor
 {\begingroup
  \let\ignorespaces\endgroup \let\set@color\set@page@color
  \color}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\nopagecolor}
% Removes any currently specified page color returning to the default transparent background.
% It is not yet supported by all driver options and so generates a warning if there is no definition in the driver file.
%    \begin{macrocode}
\def\nopagecolor
 {\@ifundefined{no@page@color}%
   {\PackageInfo{xcolor}{\string\nopagecolor\space is not supported}}%
   {\no@page@color}}
%    \end{macrocode}
%  \end{macro}
%
%
% \subsubsection{Colored boxes}
%
% \begin{macro}{\colorbox}
%   \marg{color}\marg{text}\\
%   \oarg{model}\marg{spec}\marg{text}\\
% Takes the same argument forms as |\textcolor|, but the color specifies the \emph{background} color of the box.
%    \begin{macrocode}
\def\colorbox#1#{\protect\color@box{#1}}
\def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fcolorbox}
%   \marg{frame color}\marg{background color}\marg{text}\\
%   \oarg{model}\marg{frame spec}\marg{background spec}\marg{text}\\
%   \oarg{frame model}\marg{frame spec}\oarg{background model}\marg{background spec}\marg{text}\\
%   \marg{frame color}\oarg{background model}\marg{background spec}\marg{text}\\
% Puts a frame of the first color around a box with a background specified by the second color.
% If only the first optional argument is given, it specifies the color model for both colors.
%    \begin{macrocode}
\def\fcolorbox#1#{\color@fbox{#1}}
\def\color@fbox#1#2#3#{\protect\color@fb@x{#1}{#2}{#3}}
\def\color@fb@x#1#2#3#4%
 {\color@b@x{\fboxsep\z@\color#1{#2}\XC@fbox}%
   {\@ifxempty{#3}{\color#1}{\color#3}{#4}}}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\color@b@x}
% Internal macro for |\colorbox| and |\fcolorbox|.
%    \begin{macrocode}
\long\def\color@b@x#1#2#3%
 {\leavevmode
  \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}%
  \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
  \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
  {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\XC@frameb@x}
% Common part of |\framebox| and |\fbox|.
% |#1| is a negative kern in the |\framebox| case so that the vertical rules do not add to the width of the box.
% Optimised by \People{Donald}{Arseneau}.
%    \begin{macrocode}
\def\XC@frameb@x#1%
 {\hbox
   {\@tempdima\fboxrule \advance\@tempdima\fboxsep
    \advance\@tempdima\dp\@tempboxa
    \setbox\@tempboxa\hbox
     {\lower\@tempdima\hbox
       {\vbox
         {\kern\fboxrule
          \hbox{\kern\fboxrule#1%
                \vbox{\kern\fboxsep\box\@tempboxa\kern\fboxsep}%
                #1\kern\fboxrule}%
          \kern\fboxrule}}}%
    \@tempdima\wd\@tempboxa
    \edef\@tempa{{\the\@tempdima}{\the\ht\@tempboxa}{\the\dp\@tempboxa}}%
    \box\@tempboxa\kern-\@tempdima\expandafter\boxframe\@tempa}}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\XC@fbox}
% \begin{macro}{\@frameb@x}
% If no \Option{kernelfbox} option was specified, switch to the new method in general, else only for |\fcolorbox|.
%    \begin{macrocode}
\ifXC@@fbox
  \let\@frameb@x\XC@frameb@x \let\XC@fbox\fbox
\else
  \def\XC@fbox{\let\@frameb@x\XC@frameb@x\fbox}
\fi
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
% \subsubsection{Driver-specific and generic drawing}
%
% \begin{macro}{\color@block}
%   \marg{width}\marg{height}\marg{depth}\\
% Should take up no space for \TeX, but produce a block in the current color of the specified size.
% It is mainly used for producing box backgrounds.
%  \begin{macro}{\boxframe}
%   \marg{width}\marg{height}\marg{depth}\\
% Draw a frame with a linewidth of |\fboxrule|.
% Return a |\hbox| with outer dimensions \meta{width}, \meta{height}, \meta{depth}.

%  \begin{macro}{\XC@boxframe}
%   \marg{width}\marg{height}\marg{depth}\marg{frame construction}\\
% Wrapper for |\boxframe| commands that return zero-dimension frames.
%    \begin{macrocode}
\ifnum\XC@@xcd@>\m@ne
\def\XC@boxframe#1#2#3#4%
 {\hbox{\sbox\z@{\ifdim\fboxrule>\z@ #4\fi}%
    \wd\z@#1\relax\ht\z@#2\relax\dp\z@#3\relax\box\z@}}
\fi
%    \end{macrocode}
% \end{macro}
%
% \textbf{\Option{dvips}-optimised code}
%    \begin{macrocode}
\ifcase\XC@@xcd@
%    \end{macrocode}
%
%    \begin{macrocode}
\providecommand*\color@block[3]%
 {{\set@color\hbox
    {\dimen@#3\edef\@tempa{ \number\dimen@\space}%
     \dimen@#2\edef\@tempa{ \number\dimen@\@tempa}%
     \dimen@#1\relax
     \XC@special{\number\dimen@\@tempa XCcolorblock}}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\providecommand*\boxframe[3]%
 {\XC@boxframe{#1}{#2}{#3}%
   {\dimen@#3\edef\@tempa{ \number\dimen@\space}%
    \dimen@#2\edef\@tempa{ \number\dimen@\@tempa}%
    \dimen@#1\relax
    \XC@special{\number\fboxrule\space\number\dimen@\@tempa XCboxframe}}}
%    \end{macrocode}
%
% \textbf{\Option{pdftex}-optimised code }
% There seems to be no improvement by adding a specific |\color@block| command, since the PDF format doesn't offer higher accuracy than \TeX.
% For |\boxframe| we want to achieve this PDF pseudo-code (besides initial scaling):\\[1ex]
% \centerline{\ttfamily $l$ w [] $0$ d $2$ J $0$ j $4$ M
% $1$ $0$ $0$ $1$ $\frac12\,l$ $\frac12\,l$ cm
% $0$ $-d$ $(w-l)$ $(h+d-l)$ re s}
%    \begin{macrocode}
\or
%    \end{macrocode}
%
%    \begin{macrocode}
\providecommand*\boxframe[3]%
 {\XC@boxframe{#1}{#2}{#3}%
   {\dimen@#3\edef\@tempa{ 0 -\strip@pt\dimen@\space}%
    \edef\@tempb{\advance\dimen@\the\dimen@}%
    \dimen@#2\advance\dimen@-\fboxrule\@tempb
    \edef\@tempb{ \strip@pt\dimen@\space re s}%
    \dimen@#1\advance\dimen@-\fboxrule
    \edef\@tempb{ cm\@tempa\strip@pt\dimen@\@tempb}%
    \dimen@.5\fboxrule\edef\@tempa{ \strip@pt\dimen@}%
    \XC@special
     {0.996264 0 0 0.996264 0 0 cm
      \strip@pt\fboxrule\space w [] 0 d 2 J 0 j 4 M
      1 0 0 1\@tempa\@tempa\@tempb}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \textbf{Generic code }
% The definition here works by selecting a color, and then drawing a \TeX\ rule (unless |\ifcolors@false|).
%    \begin{macrocode}
\providecommand*\color@block[3]%
 {{\set@color\rlap{\ifcolors@\vrule\@width#1\@height#2\@depth#3\fi}}}
%    \end{macrocode}
%
% The following definition was optimised by \People{Donald}{Arseneau}.
%    \begin{macrocode}
\providecommand*\boxframe[3]%
 {\hbox
   {\dimen@#2\advance\dimen@#3\relax
    \lower#3\vbox
     {\hrule\@height\fboxrule
      \@tempdima-0.5\fboxrule \ifodd\fboxrule\advance\@tempdima\m@ne sp\fi
      \kern\@tempdima
      \hbox
       {\advance\dimen@-\fboxrule
        \vrule\@width\fboxrule\@height\dimen@\@depth\z@
        \@tempdima#1\advance\@tempdima-\tw@\fboxrule \kern\@tempdima
        \vrule\@width\fboxrule\@height\dimen@\@depth\z@}%
      \kern-0.5\fboxrule
      \hrule\@height\fboxrule}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Color argument processing}
%
% \begin{macro}{\@xcolor@}
%   \marg{type-spec}\marg{driver-spec}\marg{model}\marg{spec}\\
% This is the `work-horse' that does all necessary conversions and calculations if a color (expression) has to be displayed.
% \Meta{type-spec}  and \Meta{driver-spec} are ignored.
% |\@@mix| may contain a mix expression without leading `!'.
%    \begin{macrocode}
\def\@xcolor@#1#2#3#4%
 {\XC@sdef\@@mod{#3}\edef\@@clr{#4}%
  \ifx\@@mix\@empty\else\expandafter\@xcolor@@\@@mix!!!!\@nil\fi
  \if@tempswa
    \XC@let@Nc\@@tmp{XC@cnv@\@@mod @compl}%
    \ifx\@@tmp\relax \expandafter\XC@calc@\@@clr,,,,:C\else
                     \expandafter\@@tmp\@@clr,\fi
    \let\@@clr\@@tmp
  \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xcolor@@#1!#2!#3!#4!#5\@nil
 {\dimen@\@ifxempty{#1}{100}{#1}\p@
  \edef\@@mix{\@ifxempty{#2}{white}{#2}}%
  \ifdim\dimen@=100\p@
    \expandafter\XC@postfix\@@mix]\relax
  \else\ifdim\dimen@=\z@
    \extractcolorspecs\@@mix\@@mod\@@clr
  \else
    \XC@let@Nc\@@tmp{XC@clr@\@@mod @\@@mix}%
    \ifx\@@tmp\relax
      \extractcolorspec\@@mix\@@tmp
      \ifx\@@mod\XC@mod@gray
        \edef\@@mod{\expandafter\@firstoftwo\@@tmp}%
        \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
        \convertcolorspec\XC@mod@gray\@@clr\@@mod\@@clr
      \else
        \expandafter\convertcolorspec\@@tmp\@@mod\@@tmp
      \fi
    \else
      \ifx\@@mod\XC@mod@hsb\expandafter\XC@extract@hue\@@clr:\@@hue\fi
    \fi
    \XC@inflate\@@mod\@@clr\@@tmp\@@tmp
    \expandafter\XC@mix\@@tmp,\@@clr
  \fi\fi
  \@ifxempty{#3}%
   {\@ifxempty{#4}{}{\@xcolor@@!#4!#5\@nil}}%
   {\@xcolor@@#3!#4!#5\@nil}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split}
%   \marg{ext expr}\\
% Split \Meta{ext expr} into all of its components, do the necessary calculations, and save the model of the resulting color in |\@@mod| and the parameters in |\@@clr|.
% Note: |\XC@split| opens a group which has to be closed afterwards by |\endgroup|.
%    \begin{macrocode}
\def\XC@split#1%
 {\begingroup\XC@edef\@@tmp{#1}\expandafter\XC@split@i\@@tmp>>\@nnil}
%    \end{macrocode}
%
% \begin{macro}{\XC@split@i}
% Separate first part of expression chain and apply function(s) afterwards as requested.
%    \begin{macrocode}
\def\XC@split@i#1>%
 {\def\@@tmp{#1}\XC@split@ii#1:\@nil \XC@func}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@ii}
% Check whether it is an \emph{extended} or \emph{standard} color expression.
%    \begin{macrocode}
\def\XC@split@ii#1:#2\@nil
 {\@ifxempty{#2}{\XC@split@vi}{\XC@split@iii#1,,:#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@iii}
% Initialisation for extended color expressions.
% The magic \Meta{div} is either given as second argument, or calculated as the sum of all weights.
%    \begin{macrocode}
\def\XC@split@iii#1,#2,#3:#4:%
 {\edef\XC@@mod{#1}\let\@tempa\@empty
  \ifx,#2,\XC@@tsttrue\@tempdima\z@\else\XC@@tstfalse\@tempdima#2\p@\fi
  \XC@split@iv#4;,;}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@iv}
%   \marg{expr}\marg{dec}\\
% Step through the list of \Meta{expr},\Meta{dec} pairs.
% Add \Meta{dec} to the sum of weights (in order to calculate the ultimate \Meta{div}) and append pair information to |\@tempa| command.
% At the end of the list, execute |\@tempa| and map resulting parameter vector into unit cube.
% Finally, |\@@mod| and |\@@clr| contain the desired information about color model and parameters.
%    \begin{macrocode}
\def\XC@split@iv#1,#2;%
 {\@ifxempty{#1}%
   {\let\XC@@clr\@empty \@tempa \expandafter\XC@calc@\XC@@clr,,,,:U%
    \let\@@mod\XC@@mod \let\@@clr\@@tmp}
   {\XC@append\@tempa{\XC@split@v{#1}{#2}}%
    \ifXC@@tst\advance\@tempdima#2\p@\fi
    \XC@split@iv}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@v}
%   \marg{expr}\marg{dec}\\
% Extract color specification from \Meta{expr}, convert to target model, multiply the resulting vector by the quotient of \Meta{dec} and \Meta{div}, add that vector to the overall parameter vector.
%    \begin{macrocode}
\def\XC@split@v#1#2%
 {\def\@@tmp{#1}\XC@split@vi
  \ifx\@@mod\XC@@mod\else
    \convertcolorspec\@@mod\@@clr\XC@@mod\@@clr
  \fi
  \dimen@#2\p@ \rdivide\dimen@\@tempdima
  \edef\@@scl{\strip@pt\dimen@}%
  \expandafter\XC@calc@\@@clr,,,,:S%
  \ifx\XC@@clr\@empty\let\XC@@clr\@@tmp\else
    \XC@inflate\XC@@mod\XC@@clr\@@tmp\@@tmp
    \expandafter\XC@add\@@tmp,\XC@@clr
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@vi}
% Start splitting process for standard color expression.
%    \begin{macrocode}
\def\XC@split@vi{\count@\z@ \expandafter\XC@split@vii\@@tmp!\@nil}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@vii}
% Count number of `-' signs at the beginning of the string.
%    \begin{macrocode}
\def\XC@split@vii#1%
 {\ifx#1-\advance\count@\@ne\expandafter\XC@split@vii
  \else\expandafter\XC@split@viii\expandafter#1\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@split@viii}
% Extract \Meta{name} and \Meta{mix expr} part of color expression.
% Delegate control to |\@xcolor@|.
%    \begin{macrocode}
\def\XC@split@viii#1!#2\@nil
 {\edef\@@nam{#1}\edef\@@mix{#2}%
  \ifodd\count@\@tempswatrue\else\@tempswafalse\fi
  \@ifundefinedcolor\@@nam
   {\c@lor@error{`\@@nam'}\def\@@nam{black}}{}%
  \let\xcolor@\@xcolor@\@nameuse{\string\color@\@@nam}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\XC@postfix}
% Examine the postfix of a color expression and derive the actions to be taken for color series.
%    \begin{macrocode}
\def\XC@postfix#1#2]#3\relax
 {\begingroup
  \if[#1\@tempcnta#2\relax\XC@stepabs\@@nam
  \else\@tempcnta\z@
    \@tfor\@@tok:=#1#2\do
     {\if+\@@tok\advance\@tempcnta\@ne
      \else\if-\@@tok\advance\@tempcnta\m@ne
      \else\@tempcnta\z@\expandafter\@break@tfor\fi\fi}%
    \ifnum\@tempcnta=\z@\relax\else\XC@step\@@nam\fi
    \let\@@tmp\@empty
  \fi\expandafter\endgroup\@@tmp}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@func}
%   \marg{function}|,{|\Meta[1]{arg}|,...,{|\Meta[n]{arg}|}>...\@nnil>|\\
% General macro to handle color functions.
% The number of arguments depends on the function.
% Multiple consecutive functions may be applied.
% Color model and specifications are input and output via |\@@mod| and |\@@clr|.
%    \begin{macrocode}
\def\XC@func#1>{\@ifxempty{#1}{\remove@to@nnil}{\XC@fun@#1,>\XC@func}}
\def\XC@fun@#1,#2>{\@nameuse{XC@func@#1}#2,,>}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@func@wheel}
% \begin{macro}{\XC@func@twheel}
%   \marg{angle}|,|\marg{full circle}|,>|\\
% Calculate color wheel position according to \Model{Hsb} or \Model{tHsb} model: \emph{hue} is rotated by \meta{angle} relative to \meta{full circle}.
% The latter value is taken from |\rangeHsb| if left empty.
% Finally, |\@@mod| is changed to \Model{hsb}.
%    \begin{macrocode}
\def\XC@func@wheel#1,#2,#3>{\XC@func@wh@el{#1}{#2}0}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@func@twheel#1,#2,#3>{\XC@func@wh@el{#1}{#2}1}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@func@wh@el#1#2#3%
 {\convertcolorspec\@@mod\@@clr
   {\ifcase#3 \XC@mod@Hsb\or\XC@mod@tHsb\fi}\@@clr
  \expandafter\XC@extract@hue\@@clr:\@@hue \dimen@#1\p@
  \@ifxempty{#2}{}%
   {\rdivide\dimen@{#2}\lshift\dimen@
    \dimen@\rangeHsb\dimen@\rshift\dimen@}%
  \advance\dimen@\@@hue\p@ \rdivide\dimen@\rangeHsb
  \edef\@@hue{\strip@pt\dimen@}\XC@calcU\@@hue\@@hue
  \ifcase#3
    \expandafter\XC@replace@hue\@@clr:\@@hue,\@@clr
  \or
    \XC@c@lcS\rangeHsb{}\@@hue\@@hue
    \expandafter\XC@replace@hue\@@clr:\@@hue,\@@clr
    \convertcolorspec\XC@mod@tHsb\@@clr\XC@mod@hsb\@@clr
  \fi
  \let\@@mod\XC@mod@hsb}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\XC@display}
% Write information to log file and display the current color.
%    \begin{macrocode}
\def\XC@display
 {\XC@bcolor\XC@let@cN{\string\color@.}\XC@current@color
  \ifnum\XC@type{.}=1
    \PackageWarning{xcolor}{Incompatible color definition}\else
  \ifnum\XC@tracing>2
    \begingroup \let\xcolor@\@empty \def\@nil{\string\@nil}%
    \PackageInfo{xcolor}{Setting color `\XC@current@color'}%
    \endgroup
  \fi\fi
  \XC@mcolor\set@color\XC@ecolor\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@bcolor}
% \begin{macro}{\XC@mcolor}
% \begin{macro}{\XC@ecolor}
% Hooks that may be used to execute additional code within |\XC@display| immediately before/after a color is being displayed.
% Note that |\XC@bcolor| can use the current color information given by |\current@color| and |\XC@current@color| if further manipulation of the color is necessary.
% These hooks are intended for class/package writers and not used by \XC{} itself.
% In order to prevent unwanted side effects, please make sure that all internal \XC{} variables are restored properly at the end of |\XC@display|.
%    \begin{macrocode}
\let\XC@bcolor\relax
\let\XC@mcolor\relax
\let\XC@ecolor\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Border colors for hyperlinks}
%
% \begin{macro}{\XC@bordercolor}
%   \marg{type}\marg{color}\\
% Basic macro to transform \Meta{color} into the format required by \Package{hyperref}.
% Here, \Meta{type} corresponds to the key `x\Meta{type}bordercolor'.
%    \begin{macrocode}
\def\XC@bordercolor#1#2%
 {\extractcolorspec{#2}\XC@@tmp
  \expandafter\convertcolorspec\XC@@tmp\XC@mod@rgb\XC@@tmp
  \expandafter\edef\csname @#1bordercolor\endcsname
   {\expandafter\XC@strip@comma\XC@@tmp,,\@nnil}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@pdfborder}
%   \Meta[1]{number}| |\Meta[2]{number}| |\Meta[3]{number}|\relax|\\
% Basic macro to transform a pdfborder expression into a suitable format for \Program{dvips} with a resolution of 8000~dpi.
%    \begin{macrocode}
\def\XC@pdfborder#1 #2 #3\relax
 {\def\@@scl{80}\XC@calc@#1,#2,#3,,:S%
  \edef\@pdfborder{\expandafter\XC@strip@comma\@@tmp,,\@nnil}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Colored rows in tables}
%
% The following definitions make only sense if the \Package{colortbl} package has been loaded by the \Option{table} option.
%    \begin{macrocode}
\@ifXCopt{table}{%
%    \end{macrocode}
%
% \begin{macro}{\rowcolors}
% \begin{macro}{\rowcolors*}
%   \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\
% Defines alternating colors for the next tabular environment.
% Starting with row \Meta{row}, odd and even rows get their respective colors.
% The color arguments may also be left empty (= no color).
% Optional commands may be |\hline| or |\noalign|\marg{stuff}.
%    \begin{macrocode}
 \def\rowcolors
  {\@ifstar{\@rowcmdfalse\rowc@lors}{\@rowcmdtrue\rowc@lors}}
%    \end{macrocode}
%
%    \begin{macrocode}
 \def\rowc@lors{\@testopt{\rowc@l@rs}{}}
%    \end{macrocode}
%
%    \begin{macrocode}
 \def\rowc@l@rs[#1]#2#3#4%
  {\global\rownum=\z@
   \global\@rowcolorstrue
   \@ifxempty{#3}%
     {\def\@oddrowcolor{\@norowcolor}}%
     {\def\@oddrowcolor{\gdef\CT@row@color{\CT@color{#3}}}}%
   \@ifxempty{#4}%
     {\def\@evenrowcolor{\@norowcolor}}%
     {\def\@evenrowcolor{\gdef\CT@row@color{\CT@color{#4}}}}%
   \if@rowcmd
     \def\@rowcolors
      {#1\if@rowcolors
         \noalign{\relax\ifnum\rownum<#2\@norowcolor\else
                  \ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi\fi}%
       \fi}%
   \else
     \def\@rowcolors
      {\if@rowcolors
         \ifnum\rownum<#2\noalign{\@norowcolor}\else
         #1\noalign{\ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi}\fi
       \fi}%
   \fi
   \CT@everycr{\@rowc@lors\the\everycr}%
   \ignorespaces}
%    \end{macrocode}
%
%    \begin{macrocode}
 \def\@rowc@lors{\noalign{\global\advance\rownum\@ne}\@rowcolors}
 \let\@rowcolors\@empty
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\showrowcolors}
% \begin{macro}{\hiderowcolors}
% Switch coloring mode on/off.
%    \begin{macrocode}
 \def\showrowcolors{\noalign{\global\@rowcolorstrue}\@rowcolors}
 \def\hiderowcolors{\noalign{\global\@rowcolorsfalse\@norowcolor}}
 \def\@norowcolor{\global\let\CT@row@color\relax}
 \@norowcolor
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\if@rowcolors}
% \begin{macro}{\if@rowcmd}
%    \begin{macrocode}
 \newif\if@rowcolors
 \newif\if@rowcmd
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rownum}
% Reserve a counter register.
%    \begin{macrocode}
 \@ifundefined{rownum}{\newcount\rownum}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\CT@extract}
% This is a fix for active `!' character to enable color expressions; it is apparently only necessary for |\columncolor| commands within |\multicolumn|.
%    \begin{macrocode}
 \def\CT@extract#1\columncolor#2#3\@nil
  {\if!#2%
     \let\CT@column@color\@empty
   \else
     \if[#2%
       \expandafter\CT@extractb
     \else
       \XC@edef\XC@@tmp{#2}%
       \edef\CT@column@color{\noexpand\CT@color{\XC@@tmp}}%
       \expandafter\CT@extractd
     \fi
     {#1}#3\@nil
   \fi}
%    \end{macrocode}
% \end{macro}
%
% End of conditional code for colored tables.
%    \begin{macrocode}
}{}
%    \end{macrocode}
%
%
% \subsubsection{Color information}
%
% \begin{macro}{\extractcolorspec}
%   \marg{color}\marg{cmd}\\
% Extracts the color specification of \Meta{color} and puts it into \Meta{cmd}; equivalent to
% |\def|\Meta{cmd}|{|\marg{model}\marg{spec}|}|.
%    \begin{macrocode}
\def\extractcolorspec#1#2%
 {\XC@split{#1}\edef\@@tmp{{\@@mod}{\@@clr}}\aftergroupdef#2\@@tmp}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extractcolorspecs}
%   \marg{color}\marg{model-cmd}\marg{color-cmd}\\
% Extracts the color specification of \Meta{color} and puts it into \Meta{model-cmd} and \Meta{color-cmd}, respectively.
%    \begin{macrocode}
\def\extractcolorspecs#1#2#3%
 {\extractcolorspec{#1}#3%
  \edef#2{\expandafter\@firstoftwo#3}%
  \edef#3{\expandafter\@secondoftwo#3}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@extract@hue}
% Extract first entry of comma-separated value list.
%    \begin{macrocode}
\def\XC@extract@hue#1,#2:#3{\edef#3{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@extract@hue}
% Change first entry of comma-separated value list.
%    \begin{macrocode}
\def\XC@replace@hue#1,#2:#3,#4{\edef#4{#3,#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ifundefinedcolor}
%   \marg{name}\marg{undefined}\marg{defined}\\
% Checks whether \Meta{name} is a defined color name and executes the respective code.
%    \begin{macrocode}
\def\@ifundefinedcolor#1{\@ifundefined{\string\color@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ifundefinedmodel}
%   \marg{model}\marg{undefined}\marg{defined}\\
% Checks whether \Meta{model} is a defined color model and executes the respective code.
%    \begin{macrocode}
\def\@ifundefinedmodel#1{\@ifundefined{color@#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@type}
%   \marg{name}\\
% Determines the \emph{type} of color \Meta{name}, expressed as a natural number (here, $t_1,t_2,\dots$ denote the tokens of |\\color@|\Meta{name}):
% \begin{center}
% \begin{tabular}{cll}
% \em type& \em description& \em conditions\\
% 0 & undefined\\
% 1 & unidentified& $t_1\neq|\xcolor@|$\\
% 2 & named & $t_1=|\xcolor@|\quad t_2\neq\emptyset$\\
% 3 & declared & $t_1=|\xcolor@|\quad t_2=\emptyset\quad t_3\neq\emptyset$\\
% 4 & undeclared & $t_1=|\xcolor@|\quad t_2=\emptyset\quad t_3=\emptyset$\\
% \end{tabular}
% \end{center}
%    \begin{macrocode}
\def\XC@type#1%
 {\expandafter\expandafter\expandafter\XC@typ@
  \csname\string\color@#1\endcsname\@empty\@empty\@empty\XC@@}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@typ@#1#2#3#4\XC@@
 {\ifx#1\relax 0\else
    \ifx#1\xcolor@
      \ifx$#2$%
        \ifx$#3$4\else3\fi\@gobbletwo
      \else2\fi\@gobbletwo
    \else1\fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@info}
%   \marg{color}\marg{cmd}\\
% Determines the \emph{type} of color \Meta{color}, expressed as a natural number; the result is stored in \Meta{cmd}.
% \begin{center}
% \begin{tabular}{cll}
% \em type& \em description& \em examples\\
% 0 & implicit name& `|.|'\\
% 1 & explicit name& `|red|', `|green|'\\
% 2 & standard color expression& `|-red|', `|green!50|'\\
% 3 & extended color expression& `|rgb:-red,1;green!50,2|'\\
% 4 & color function expression& `|rgb:-red,1;green!50,2>wheel,30|'\\
% \end{tabular}
% \end{center}
%    \begin{macrocode}
\def\XC@info#1#2%
 {\XC@edef#2{#1}%
  \if.#2\def#2{0}\else\expandafter\in@\expandafter>\expandafter{#2}%
  \ifin@\def#2{4}\else\expandafter\in@\expandafter:\expandafter{#2}%
  \ifin@\def#2{3}\else\expandafter\in@\expandafter!\expandafter{#2}%
  \ifin@\def#2{2}\else\edef#2{\noexpand\in@{/-}{/#2}}#2%
  \edef#2{\ifin@2\else1\fi}\fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tracingcolors}
% Put the integer following |\tracingcolors| into the macro |\XC@tracing|.
%    \begin{macrocode}
\def\tracingcolors{\begingroup\afterassignment\XC@tracingcolors\count@}
\def\XC@tracingcolors{\aftergroupdef\XC@tracing{\the\count@}}
%    \end{macrocode}
%
%    \begin{macrocode}
\tracingcolors=0
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@logdef}
%   \marg{name}\\
% Issue a log file information if color \Meta{name} is being (re)defined.
%    \begin{macrocode}
\def\XC@logdef#1%
 {\ifnum\XC@tracing>1
    \@ifundefinedcolor{#1}%
     {\ifnum\XC@tracing>2
        \PackageInfo{xcolor}{Defining color `#1'}%
      \fi}%
     {\PackageInfo{xcolor}{Redefining color `#1'}}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Color testing}
%
% \begin{environment}{testcolors}
%   \oarg{num models}\\
% This is a simple tabular environment in order to test (display) colors in different models, showing both the visual result and the model-specific parameters.
% The optional \Meta{num models} argument is a comma-separated list of \emph{numerical} color models.
%    \begin{macrocode}
\newenvironment*{testcolors}[1][rgb,cmyk,hsb,HTML]%
 {\let\@@nam\@empty\count@\z@
  \@for\@@tmp:=#1\do
    {\advance\count@\@ne
     \XC@sdef\@@tmp{\@@tmp}\edef\@@nam{\@@nam{\@@tmp}}}%
  \edef\@@num{\the\count@}%
%    \end{macrocode}
%
% Check whether the actual font belongs to a set of OT1-encoded monospaced fonts in order to display |>| instead of |\textgreater|.
% \begin{macro}{\XC@@gt}
%    \begin{macrocode}
  \def\XC@@gt{\textgreater}\def\@@tmp{OT1}%
  \ifx\f@encoding\@@tmp
    \@expandtwoargs\in@{,\f@family,}{,cmtt,pcr,}%
    \ifin@\def\XC@@gt{>}\fi
  \fi
%    \end{macrocode}
%  \end{macro}
%
% Disable prologue and tracing commands for temporary color definitions.
%    \begin{macrocode}
  \def\XC@@xcp@{-1}\ifnum\XC@tracing>1 \def\XC@tracing{1}\fi
%    \end{macrocode}
%
% \begin{macro}{\testcolor}
%   \marg{color}\\
%   \oarg{model-list}\marg{spec-list}\\
% Each |\testcolor| command generates a table row.
% If the column-model matches the model of the color in question, its parameters are underlined.
%    \begin{macrocode}
  \def\testcolor{\@testopt{\@testcolor}{}}%
  \def\@testcolor[##1]##2%
   {\XC@mdef\@@mod{##1}\XC@edef\@@clr{##2}%
    \ifx\@@mod\@empty
      \let\@@arg\@@clr\XC@replace\@@arg>\XC@@gt\else
      \edef\@@arg{[\@@mod]{\@@clr}}\XC@definecolor[]{*}\@@mod\@@clr
      \def\@@clr{*}\fi
    \XC@append\@@arg{&}\extractcolorspecs\@@clr\@@mod\@@clr
    \@testc@lor}%
%    \end{macrocode}
%  \end{macro}
%
% Common loop macro for table head and |\testcolor| rows.
% Note that this command is only available within the |testcolors| environment.
%    \begin{macrocode}
  \def\@testc@lor
   {\count@\z@
    \expandafter\@tfor\expandafter\@@tmp\expandafter:\expandafter=\@@nam\do
     {\ifx\@@clr\@empty
        \edef\@@cmd{\noexpand\textbf{\@@tmp}}%
      \else
        \convertcolorspec\@@mod\@@clr\@@tmp\@@cmd
        \edef\@@cmd
         {\noexpand\@testc@l@r{\@@tmp}{\@@cmd}%
          \ifx\@@mod\@@tmp\noexpand\underline\fi
          {\expandafter\XC@strip@comma\@@cmd,,\@nnil}}%
      \fi
      \expandafter\XC@append\expandafter\@@arg\expandafter{\@@cmd}%
      \advance\count@\@ne
      \ifnum\count@=\@@num\XC@append\@@arg{\\}\else\XC@append\@@arg{&}\fi}%
    \@@arg}%
%    \end{macrocode}
%
% Display color sample box:
%    \begin{macrocode}
  \def\@testc@l@r##1##2%
   {\fboxsep\z@\fbox{\colorbox[##1]{##2}{\phantom{XX}}} }%
%    \end{macrocode}
%
% Now start the table:
%    \begin{macrocode}
  \tabular{@{}l*{\@@num}{l}@{}}%
  \def\@@arg{\textbf{color}& }\let\@@clr\@empty\@testc@lor}%
%    \end{macrocode}
%
% End of environment:
%    \begin{macrocode}
 {\endtabular\ignorespacesafterend}
%    \end{macrocode}
%  \end{environment}
%
%
% \subsubsection{Extra groups}
% Turning on extra groups in the standard \LaTeX\ commands, so that color commands are scoped corectly.
%
% Like |\normalcolor|, the following five commands are defined in the kernel, with empty definitions (|\relax|).
% This means that they can be used to make macros in packages `color safe'.
% The commands will not have any effect unless a user also uses a color package, when the `active definitions' here will take effect and keep color commands correctly scoped.
%
% \begin{macro}{\color@setgroup}
% This is to be used in contexts (e.g., `lrbox') where text is to be saved and used after some other, unknown, text that may contain color commands.
% A matching |\color@endgroup| should be used at the end of the text.
%    \begin{macrocode}
\def\color@setgroup{\begingroup\set@color}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\color@begingroup}
% This is to be used at the start of contexts that may contain color commands, but where it is not necessary to save the current color.
% Examples of this are in the box commands of \File{ltboxes.dtx} where user-supplied text is saved internally in a box between |\color@begingroup|, |\color@endgroup|, but the box is used before any other color commands could intervene.
% A matching |\color@endgroup| should be used at the end of the text.
%    \begin{macrocode}
\let\color@begingroup\begingroup
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\color@endgroup}
% To be used to close the `group' started by one of the above two commands.
% The |\endgraf| in its definition is required in the case of groups of text in vertical `par' mode, but doesn't do any harm in horizontal `LR' contexts.
%    \begin{macrocode}
\def\color@endgroup{\endgraf\endgroup}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\color@hbox}
% To be used to open a `colored hbox'
%    \begin{macrocode}
\def\color@hbox{\hbox\bgroup\color@begingroup}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\color@vbox}
% To be used to open a `colored hbox'
%    \begin{macrocode}
\def\color@vbox{\vbox\bgroup\color@begingroup}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\color@endbox}
% To be used to close a `colored (h/v)box'
%    \begin{macrocode}
\def\color@endbox{\color@endgroup\egroup}
%    \end{macrocode}
%  \end{macro}
%
%
%
% \subsection{Color calculation}
%
% \subsubsection{Color conversion}
%
% \begin{macro}{\convertcolorspec}
%   \marg{source model}\marg{spec}\marg{target model}\marg{cmd}\\
% General color conversion command.
%    \begin{macrocode}
\def\convertcolorspec#1#2#3#4%
 {\begingroup
  \XC@sdef\sm{#1}\XC@sdef\tm{#3}\edef\@@tmp{#2}%
  \ifx\sm\XC@mod@named\extractcolorspecs\@@tmp\sm\@@tmp\fi
  \ifx\sm\tm\else\csname XC@cnv@\sm\expandafter\endcsname\@@tmp,\fi
  \aftergroupdef#4\@@tmp}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@coremodel}
%   \marg{model-cmd}\marg{color-cmd}\\
% Convert color, given by \marg{model-cmd} and \marg{color-cmd}, into parametrisation in one of the \emph{core} models.
% The result is again saved in \marg{model-cmd} and \marg{color-cmd}.
%    \begin{macrocode}
\def\XC@coremodel#1#2%
 {\XC@ifxcase#1%
   {\XC@mod@RGB {\convertcolorspec#1#2\XC@mod@rgb#2\let#1\XC@mod@rgb}%
    \XC@mod@HTML{\convertcolorspec#1#2\XC@mod@rgb#2\let#1\XC@mod@rgb}%
    \XC@mod@Hsb {\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@tHsb{\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@HSB {\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@Gray{\convertcolorspec#1#2\XC@mod@gray#2\let#1\XC@mod@gray}%
    \XC@mod@wave{\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@named{}%
    \XC@mod@ps{}}%
   {\expandafter\XC@calc@#2,,,,:N\let#2\@@tmp}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@rgb}
%   \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
%    \begin{macrocode}
\def\XC@cnv@rgb#1,#2,#3,%
 {\XC@ifxcase\tm
   {\XC@mod@cmy {\XC@calc@#1,#2,#3,,:C}%
    \XC@mod@cmyk
     {\XC@calc@#1,#2,#3,,:C\expandafter\XC@cnv@cmy@cmyk\@@tmp,}%
    \XC@mod@RGB {\edef\@@scl{\rangeRGB}\XC@calc@#1,#2,#3,,:M}%
    \XC@mod@HTML{\edef\@@scl{\@cclv}\XC@calc@#1,#2,#3,,:M%
      \expandafter\XC@calc@\@@tmp,,:H%
      \expandafter\XC@cnv@rgb@HTML\@@tmp,}%
    \XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,}%
    \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@cnv@gray\@@tmp,}}%
   {\XC@cnv@rgb@hsb#1,#2,#3,\XC@cnv@hsb@}}
%    \end{macrocode}
%
% \begin{macro}{\XC@cnv@rgb@}
%    \begin{macrocode}
\def\XC@cnv@rgb@
 {\ifx\tm\XC@mod@rgb\else\expandafter\XC@cnv@rgb\@@tmp,\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\XC@cnv@rgb@hsb}
%   \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
%    \begin{macrocode}
\def\XC@cnv@rgb@hsb#1,#2,#3,%
 {\count@\z@
  \ifdim#2\p@>#1\p@ \else\advance\count@4 \fi
  \ifdim#3\p@>#2\p@ \else\advance\count@2 \fi
  \ifdim#1\p@>#3\p@ \else\advance\count@1 \fi
  \ifcase\count@\or
  \XC@c@v@rgb@hsb{#3}{#2}{#1}3{}\or
  \XC@c@v@rgb@hsb{#2}{#1}{#3}1{}\or
  \XC@c@v@rgb@hsb{#2}{#3}{#1}3-\or
  \XC@c@v@rgb@hsb{#1}{#3}{#2}5{}\or
  \XC@c@v@rgb@hsb{#3}{#1}{#2}5-\or
  \XC@c@v@rgb@hsb{#1}{#2}{#3}1-\or
  \def\@tempa{0}\def\@tempb{0}\XC@calcN{#3}\@tempc
  \fi
  \edef\@@tmp{\@tempa,\@tempb,\@tempc}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@c@v@rgb@hsb}
%   \marg{max}\marg{med}\marg{min}\marg{const}\marg{sign}
%    \begin{macrocode}
\def\XC@c@v@rgb@hsb#1#2#3#4#5%
 {\XC@calcN{#1}\@tempc \llshiftset\dimen@{#1}%
  \llshiftset\@tempdimb{-#3}\advance\@tempdimb\dimen@
  \llshiftset\@tempdima{-#5#2}\advance\@tempdima#5\dimen@
  \advance\@tempdima#4\@tempdimb \rdivide\@tempdima{6\@tempdimb}%
  \edef\@tempa{\ifdim\@tempdima>\p@1\else\strip@pt\@tempdima\fi}%
  \rdivide\@tempdimb\dimen@
  \edef\@tempb{\strip@pt\@tempdimb}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@rgb@gray}
%   \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
%    \begin{macrocode}
\def\XC@cnv@rgb@gray#1,#2,#3,%
 {\llshiftset\dimen@{#1}\@tempdima30\dimen@
  \llshiftset\dimen@{#2}\advance\@tempdima59\dimen@
  \llshiftset\dimen@{#3}\advance\@tempdima11\dimen@
  \rrshift\@tempdima \rdivide\@tempdima{100}%
  \edef\@@tmp{\strip@pt\@tempdima}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@rgb@HTML}
%   \Meta{red}|,|\Meta{green}|,|\Meta{blue}|,|
%    \begin{macrocode}
\def\XC@cnv@rgb@HTML#1,#2,#3,%
 {\edef\@@tmp{#1#2#3}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@cmy}
%   \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|
%    \begin{macrocode}
\def\XC@cnv@cmy#1,#2,#3,%
 {\XC@ifxcase\tm
   {\XC@mod@cmyk{\XC@cnv@cmy@cmyk#1,#2,#3,}%
    \XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@calcC\@@tmp\@@tmp}%
    \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@calcC\@@tmp\@@tmp
      \XC@cnv@gray\@@tmp,}}%
   {\XC@calc@#1,#2,#3,,:C\XC@cnv@rgb@}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@cmy@cmyk}
%   \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\\
% This transformation includes linear \emph{undercolor-removal} and \emph{black-generation}, as specified by the 4-dimensional parameter vector |\adjustUCRBG|.
%    \begin{macrocode}
\def\XC@cnv@cmy@cmyk#1,#2,#3,%
 {\edef\@@scl
   {\ifdim#1\p@<#2\p@
    \ifdim#1\p@<#3\p@ #1\else #3\fi \else
    \ifdim#2\p@<#3\p@ #2\else #3\fi \fi}%
  \expandafter\XC@calc@\adjustUCRBG,:S%
  \expandafter\XC@c@v@cmy@cmyk\@@tmp,#1,#2,#3,}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@c@v@cmy@cmyk#1,#2,#3,#4,#5,#6,#7,%
 {\XC@add#5,#6,#7,,-#1,-#2,-#3,,\@@tmp \edef\@@tmp{\@@tmp,#4}%
  \expandafter\XC@calc@\@@tmp,:N}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@cmyk}
%   \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\Meta{black}|,|
%    \begin{macrocode}
\def\XC@cnv@cmyk#1,#2,#3,#4,%
 {\XC@ifxcase\tm
   {\XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,\edef\@@arg{#4}%
      \XC@calcT\@@tmp\@@tmp \XC@calcC\@@tmp\@@tmp}%
    \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\edef\@@arg{#4}%
      \XC@calcT\@@tmp\@@tmp \XC@calcC\@@tmp\@@tmp \XC@cnv@gray\@@tmp,}}%
   {\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
    \ifx\tm\XC@mod@cmy\else\expandafter\XC@cnv@cmy\@@tmp,\fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@cmyk@cmy}
%   \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\Meta{black}|,|
%    \begin{macrocode}
\def\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
 {\edef\@@arg{#4}\XC@calc@#1,#2,#3,,:T}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@hsb}
%   \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@hsb#1,#2,#3,%
 {\XC@ifxcase\tm
   {\XC@mod@Hsb {\XC@cnv@hsb@Hsb#1,#2,#3,}%
    \XC@mod@tHsb{\XC@cnv@hsb@Hsb#1,#2,#3,\expandafter\XC@cnv@Hsb\@@tmp,}%
    \XC@mod@HSB {\edef\@@scl{\rangeHSB}\XC@calc@#1,#2,#3,,:M}}%
   {\XC@cnv@hsb@rgb#1,#2,#3,\XC@cnv@rgb@}}
%    \end{macrocode}
%
% \begin{macro}{\XC@cnv@hsb@}
%    \begin{macrocode}
\def\XC@cnv@hsb@
 {\ifx\tm\XC@mod@hsb\else\expandafter\XC@cnv@hsb\@@tmp,\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\XC@cnv@hsb@rgb}
%   \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@hsb@rgb#1,#2,#3,%
 {\llshiftset\dimen@{#1}\dimen@6\dimen@ \rrshift\dimen@
  \afterassignment\dimen@\count@=\the\dimen@
  \edef\@@tmp{\strip@pt\dimen@}%
  \ifodd\count@\else\XC@calcC\@@tmp\@@tmp\fi
  \edef\@@tmp
   {\ifcase\count@ 0,\@@tmp,1\or \@@tmp,0,1\or 1,0,\@@tmp\or
    1,\@@tmp,0\or \@@tmp,1,0\or 0,1,\@@tmp\or 0,\@@tmp,1\fi}%
  \edef\@@scl{#2}\expandafter\XC@calc@\@@tmp,,:S%
  \expandafter\XC@calc@\@@tmp,,:C%
  \edef\@@scl{#3}\expandafter\XC@calc@\@@tmp,,:S%
  \expandafter\XC@calc@\@@tmp,,:N}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@hsb@Hsb}
%   \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@hsb@Hsb#1,#2,#3,%
 {\XC@c@lcS\rangeHsb{,#2,#3}{#1}\@@tmp}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@gray}
%   \Meta{gray}|,|
%    \begin{macrocode}
\def\XC@cnv@gray#1,%
 {\XC@ifxcase\tm
   {\XC@mod@rgb {\XC@calcN{#1}\@@tmp \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
    \XC@mod@cmy {\XC@calcC{#1}\@@tmp \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
    \XC@mod@cmyk{\XC@calcC{#1}\@@tmp \edef\@@tmp{0,0,0,\@@tmp}}%
    \XC@mod@RGB {\edef\@@scl{\rangeRGB}\XC@calcM{#1}\@@tmp
      \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
    \XC@mod@HTML{\edef\@@scl{\@cclv}\XC@calcM{#1}\@@tmp
      \XC@calcH\@@tmp\@@tmp \edef\@@tmp{\@@tmp\@@tmp\@@tmp}}%
    \XC@mod@HSB {\edef\@@scl{\rangeHSB}\XC@calcM{#1}\@@tmp
      \edef\@@tmp{0,0,\@@tmp}}%
    \XC@mod@Gray{\edef\@@scl{\rangeGray}\XC@calcM{#1}\@@tmp}}%
   {\XC@calcN{#1}\@@tmp \edef\@@tmp{0,0,\@@tmp}}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@RGB}
%   \Meta{Red}|,|\Meta{Green}|,|\Meta{Blue}|,|
%    \begin{macrocode}
\def\XC@cnv@RGB#1,#2,#3,%
 {\edef\@@scl{\rangeRGB}\XC@calc@#1,#2,#3,,:D\XC@cnv@rgb@}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@HTML}
%   \Meta{RRGGBB}|,|
%    \begin{macrocode}
\def\XC@cnv@HTML#1,%
 {\edef\@@tmp{\expandafter\@hex@Hex#1\relax}\expandafter\XC@cnv@HTML@\@@tmp
  \edef\@@scl{\@cclv}\expandafter\XC@calc@\@@tmp,,:D\XC@cnv@rgb@}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@cnv@HTML@#1#2#3#4#5#6%
 {\edef\@@tmp{\number"#1#2,\number"#3#4,\number"#5#6}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@Hsb}
%   \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@Hsb#1,#2,#3,%
 {\ifx\tm\XC@mod@tHsb\XC@cnv@@Hsb#1,#2,#3,\XC@cnv@Hsb@
  \else\XC@cnv@Hsb@hsb#1,#2,#3,\XC@cnv@hsb@\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@Hsb@hsb}
%   \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@Hsb@hsb#1,#2,#3,%
 {\XC@c@lcD\rangeHsb{,#2,#3}{#1}\@@tmp}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@@Hsb}
%   \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|\marg{cmd}
%    \begin{macrocode}
\def\XC@cnv@@Hsb#1,#2,#3,#4%
 {\dimen@\rangeHsb\p@ \advance\dimen@\p@ \edef\@@tmp{\strip@pt\dimen@}%
  \edef\@@tmp{0,0;\rangetHsb;\rangeHsb,\rangeHsb;\@@tmp,\@@tmp;}%
  \dimen@#1\p@ \expandafter#4\@@tmp\@nnil
  \edef\@@tmp{\strip@pt\dimen@,#2,#3}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@Hsb@}
%   \Meta{x}|,|\Meta{y}|;|\Meta{x'}|,|\Meta{y'}|;|
%    \begin{macrocode}
\def\XC@cnv@Hsb@#1,#2;#3,#4;%
 {\ifdim\dimen@<#4\p@
    \@tempdima#3\p@ \advance\@tempdima-#1\p@
    \@tempdimb#4\p@ \advance\@tempdimb-#2\p@
    \rdivide\@tempdima\@tempdimb
    \advance\dimen@-#2\p@ \rmultiply\dimen@{\strip@pt\@tempdima}%
    \advance\dimen@#1\p@ \expandafter\remove@to@nnil
  \else
    \def\@@tmp{\XC@cnv@Hsb@#3,#4;}\expandafter\@@tmp
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@tHsb}
%   \Meta{hue\Circ}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@tHsb#1,#2,#3,%
 {\XC@cnv@@Hsb#1,#2,#3,\XC@cnv@tHsb@
  \ifx\tm\XC@mod@Hsb\else\expandafter\XC@cnv@Hsb\@@tmp,\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@tHsb@}
%   \Meta{x}|,|\Meta{y}|;|\Meta{x'}|,|\Meta{y'}|;|
%    \begin{macrocode}
\def\XC@cnv@tHsb@#1,#2;#3,#4;%
 {\ifdim\dimen@<#3\p@
    \@tempdima#4\p@ \advance\@tempdima-#2\p@
    \@tempdimb#3\p@ \advance\@tempdimb-#1\p@
    \rdivide\@tempdima\@tempdimb
    \advance\dimen@-#1\p@ \rmultiply\dimen@{\strip@pt\@tempdima}%
    \advance\dimen@#2\p@ \expandafter\remove@to@nnil
  \else
    \def\@@tmp{\XC@cnv@tHsb@#3,#4;}\expandafter\@@tmp
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@HSB}
%   \Meta{Hue}|,|\Meta{Saturation}|,|\Meta{Brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@HSB#1,#2,#3,%
 {\edef\@@scl{\rangeHSB}\XC@calc@#1,#2,#3,,:D\XC@cnv@hsb@}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@Gray}
%   \Meta{Gray}|,|
%    \begin{macrocode}
\def\XC@cnv@Gray#1,%
 {\XC@c@lcD\rangeGray{}{#1}\@@tmp \XC@cnv@gray\@@tmp,}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\XC@cnv@wave}
%   \Meta{lambda}|,|
%    \begin{macrocode}
\def\XC@cnv@wave#1,%
 {\XC@cnv@wave@hsb#1,\XC@cnv@hsb@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@wave@hsb}
%   \Meta{lambda}|,|
%    \begin{macrocode}
\def\XC@cnv@wave@hsb#1,%
 {\@tempdima#1\p@
%    \end{macrocode}
%
% Calculate hue:
%    \begin{macrocode}
  \ifdim\@tempdima<440\p@
    \XC@c@v@wave@hsb{-.0166667}{7.33333}4{}\else
  \ifdim\@tempdima<490\p@
    \XC@c@v@wave@hsb{.02}{-8.8}4-\else
  \ifdim\@tempdima<510\p@
    \XC@c@v@wave@hsb{-.05}{25.5}2{}\else
  \ifdim\@tempdima<580\p@
    \XC@c@v@wave@hsb{.0142857}{-7.28571}2-\else
  \ifdim\@tempdima<645\p@
    \XC@c@v@wave@hsb{-.0153846}{9.92308}0{}\else
  \dimen@\z@ \fi\fi\fi\fi\fi
  \divide\dimen@6\relax
  \edef\@@tmp{\strip@pt\dimen@,1,}%
%    \end{macrocode}
%
% Calculate brightness:
%    \begin{macrocode}
  \ifdim\@tempdima<420\p@
    \XC@c@v@wave@hsb{.0175}{-6.35}0{}\else
  \ifdim\@tempdima>700\p@
    \XC@c@v@wave@hsb{-.00875}{7.125}0{}\else
  \dimen@\p@ \fi\fi
  \edef\@@tmp{\@@tmp\strip@pt\dimen@}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@c@v@wave@hsb}
%   \marg{factor}\marg{const}\marg{offset}\marg{sign}\\
% Calculates $\Meta{offset} + \Meta{sign}\cdot\varrho\bigl(\Meta{const} + \Meta{factor}\cdot\lambda\bigr)$, where $\varrho$ is the reduction function.
% The result is stored in |\dimen@|.
%    \begin{macrocode}
\def\XC@c@v@wave@hsb#1#2#3#4%
 {\dimen@#1\@tempdima \advance\dimen@#2\p@
  \XC@calcR{\strip@pt\dimen@}\@tempa
  \dimen@#4\@tempa\p@ \advance\dimen@#3\p@}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Color complement}
%
% \begin{macro}{\XC@cnv@cmyk@compl}
%   \Meta{cyan}|,|\Meta{magenta}|,|\Meta{yellow}|,|\Meta{black}|,|
%    \begin{macrocode}
\def\XC@cnv@cmyk@compl#1,#2,#3,#4,%
 {\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
  \expandafter\XC@calc@\@@tmp,,:C\expandafter\XC@cnv@cmy@cmyk\@@tmp,}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@cnv@hsb@compl}
%   \Meta{hue}|,|\Meta{saturation}|,|\Meta{brightness}|,|
%    \begin{macrocode}
\def\XC@cnv@hsb@compl#1,#2,#3,%
 {\lshiftset\dimen@{#1}\advance\dimen@\ifdim\dimen@<5\p@-\fi-5\p@
  \rshift\dimen@ \edef\@@tmp{\strip@pt\dimen@}%
  \lshiftset\dimen@{#3}\@tempdima#2\dimen@
  \@tempdimb\@tempdima \advance\@tempdimb10\p@ \advance\@tempdimb-\dimen@
  \ifdim\@tempdimb=\z@
    \edef\@@tmp{\@@tmp,0,0}%
  \else
    \rdivide\@tempdima\@tempdimb \rshift\@tempdimb
    \edef\@@tmp{\@@tmp,\strip@pt\@tempdima,\strip@pt\@tempdimb}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
%
% \subsection{Color initialisation}
%
% \subsubsection{Support for missing color models}
%
% These macros provide generic support for missing color models in specific drivers.
% For example, \File{pdftex.def} does not support the \Model{hsb} model.
% It is assumed that at least one of the models \Model{rgb}, \Model{RGB}, \Model{HTML}, \Model{hsb}, \Model{Hsb}, \Model{HSB}, \Model{cmy}, \Model{cmyk}, \Model{gray}, \Model{Gray} exists.
%
% \begin{macro}{\substitutecolormodel}
%   \marg{source model}\marg{target model-list}\\
% Substitute \Meta{source model} by the first actually present model from \Meta{target model-list}:
% each reference to the driver-specific command |\color@|\Meta{source model} is replaced by a color model conversion, followed by the driver-specific command |\color@|\Meta{target model}.
%    \begin{macrocode}
\def\substitutecolormodel#1#2%
 {\XC@sdef\XC@@tmp{\expandafter\XC@substitutecolormodel#2/ignore/\@nnil}%
  \ifx\XC@@tmp\XC@mod@ignore
    \XC@let@cN{color@#1}\color@ignore
  \else
    \expandafter\edef\csname color@#1\endcsname##1##2%
     {\noexpand\convertcolorspec
      \expandafter\noexpand\csname XC@mod@#1\endcsname{##2}%
      \expandafter\noexpand\csname XC@mod@\XC@@tmp\endcsname
      \noexpand\XC@@tmp\noexpand\expandafter
      \expandafter\noexpand\csname color@\XC@@tmp\endcsname
      \noexpand\expandafter##1\noexpand\expandafter{\noexpand\XC@@tmp}}%
  \fi
  \expandafter\xglobalize@\csname color@#1\endcsname \xglobal@stop
  \PackageInfo{xcolor}{Model `#1' substituted by `\XC@@tmp'}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\XC@substitutecolormodel#1/%
 {\@ifundefinedmodel{#1}{\XC@substitutecolormodel}{#1\remove@to@nnil}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@ignore}
%   \marg{cmd}\marg{spec}\\
% Empty color model: no driver-specific representation at all.
%    \begin{macrocode}
\def\color@ignore#1#2{\def#1{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@rgb}
%   \marg{cmd}\marg{spec}\\
% Takes the color specification \Meta{spec}, turns it into a driver-specific representation and puts the result into the macro \Meta{cmd}.
% For example, if \File{dvips.def} is loaded, then |\color@rgb\foo{1,0,0}| will be equivalent to |\def\foo{rgb 1 0 0}|.
% In the case of \File{pdftex.def}, it will act like |\def\foo{1 0 0 rg 1 0 0 RG}| instead.
%    \begin{macrocode}
\@ifundefinedmodel{rgb}%
 {\substitutecolormodel{rgb}{RGB/HTML/hsb/Hsb/HSB/cmy/cmyk/gray/Gray}}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@cmyk}
%   \marg{cmd}\marg{spec}
%    \begin{macrocode}
\@ifundefinedmodel{cmyk}{\substitutecolormodel{cmyk}{cmy/rgb}}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@cmy}
%   \marg{cmd}\marg{spec}
%    \begin{macrocode}
\@ifundefinedmodel{cmy}%
 {\PackageInfo{xcolor}{Model `cmy' substituted by `cmy0'}
  \def\color@cmy#1#2{\color@cmyk#1{#2,0}}}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@hsb}
%   \marg{cmd}\marg{spec}\\
% Since the \Option{dvipdfm} and \Option{textures} drivers only pretend to support \Model{hsb}, we have to check for these drivers.
%    \begin{macrocode}
\@ifundefinedmodel{hsb}{\@tempswatrue}%
 {\XC@ifcase\XC@@drv{{dvipdfm,textures}\@tempswatrue}\@tempswafalse}
\if@tempswa
  \substitutecolormodel{hsb}{Hsb/HSB/rgb}
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@RGB}
%   \marg{cmd}\marg{spec}\\
% If the model is supported and |\rangeRGB| equals 255, we stick to the algorithm provided by the driver.
%    \begin{macrocode}
\@ifundefinedmodel{RGB}%
 {\substitutecolormodel{RGB}{HTML/rgb}}
 {\PackageInfo{xcolor}{Model `RGB' extended}
  \let\XC@color@RGB\color@RGB
  \def\color@RGB#1#2%
   {\relax\ifnum\rangeRGB=255
      \XC@color@RGB#1{#2}%
    \else
      \convertcolorspec\XC@mod@RGB{#2}\XC@mod@rgb\XC@@tmp
      \expandafter\color@rgb\expandafter#1\expandafter{\XC@@tmp}%
    \fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\color@gray}
% \begin{macro}{\color@HTML}
% \begin{macro}{\color@Hsb}
% \begin{macro}{\color@tHsb}
% \begin{macro}{\color@HSB}
% \begin{macro}{\color@Gray}
% \begin{macro}{\color@wave}
%   \marg{cmd}\marg{spec}
%    \begin{macrocode}
\@ifundefinedmodel{gray}{\substitutecolormodel{gray}{Gray/rgb}}{}
\@ifundefinedmodel{HTML}{\substitutecolormodel{HTML}{rgb}}{}
\@ifundefinedmodel{Hsb}{\substitutecolormodel{Hsb}{hsb}}{}
\@ifundefinedmodel{tHsb}{\substitutecolormodel{tHsb}{hsb}}{}
\@ifundefinedmodel{HSB}{\substitutecolormodel{HSB}{hsb}}{}
\@ifundefinedmodel{Gray}{\substitutecolormodel{Gray}{gray}}{}
\@ifundefinedmodel{wave}{\substitutecolormodel{wave}{hsb}}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{\Index{PostScript}-related stuff}
%
% \begin{macro}{\XC@getcolor}
%   \marg{color}\marg{cmd}\\
%   \marg{color command}\marg{cmd}\\
%   |{|\oarg{model}\marg{spec}|}|\marg{cmd}\\
% Transformation of a color, given by the first argument, especially needed for \Package{pstricks}.
% The result will always be an internal color representation (as described in section \vref{sec.definition}) and is stored in \Meta{cmd}.
% There are different ways of specifying the color:
% \begin{itemize}
% \item \Meta{color} is a color name, expression, etc., e.g., |\XC@getcolor{green!50}\foo|;
% \item \Meta{color command} is a macro whose \emph{first level} expansion is an internal color representation, e.g., |\XC@getcolor\pslinecolor\foo|;
% \item \Meta{model} and \Meta{spec} provide, as usual, explicit parameter specifications.
% \end{itemize}
%    \begin{macrocode}
\def\XC@getcolor#1#2%
 {\begingroup\toks@{#1}\XC@getc@lor#1\XC@@\aftergroupdef#2{\@@tmp}}
%    \end{macrocode}
%
% Check whether the argument consists of one or more tokens.
% In the first case, expand by one level and go to next check.
% In the second case, assume it's a \Meta{color} and simulate its display, but without performing the real |\set@color| command (which would insert |\special|s, possibly causing trouble with blank spaces).
% This simulation ensures that we get exactly the same color --- including all blending, masking --- as if we had executed an explicit |\color| command at that point.
%    \begin{macrocode}
\def\XC@getc@lor#1#2\XC@@
 {\@ifxempty{#2}%
   {\expandafter\XC@getc@l@r#1\XC@@}%
   {\let\set@color\relax
    \ifx#1[%
      \expandafter\@undeclaredcolor\the\toks@\else
      \expandafter\@declaredcolor\expandafter{\the\toks@}\fi
    \let\@@tmp\XC@current@color}}
%    \end{macrocode}
%
% Check whether the first token is |\xcolor@|.
% In that case, |#1#2| is assumed to be a complete internal color representation.
% Otherwise, perform a simulation as described before.
%    \begin{macrocode}
\def\XC@getc@l@r#1#2\XC@@
 {\ifx#1\xcolor@
    \def\@@tmp{\xcolor@#2}%
  \else
    \let\set@color\relax
    \expandafter\@declaredcolor\expandafter{\the\toks@}%
    \let\@@tmp\XC@current@color
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\XC@usecolor}
%   \marg{name}\\
%   \marg{color command}\\
% Transformation of a color into \Index{PostScript} code.
% The argument may be either a command whose \emph{first-level} expansion is an internal color representation (e.g., the outcome of an |\XC@getcolor| command: |\XC@usecolor\pslinecolor|), or a \Meta{name} (e.g., |\XC@usecolor{green}|).
% Note that non-trivial color expressions like |green!50| are forbidden and that |\XC@usecolor| is fully expandable, for example, |\edef\foo{\XC@usecolor{green}}| is valid.
%    \begin{macrocode}
\def\XC@usecolor#1{\expandafter\XC@usec@lor#1\XC@@}
\def\XC@usec@lor#1#2\XC@@
 {\ifx#1\xcolor@
    \expandafter\expandafter\expandafter\c@lor@to@ps#1#2\@@
  \else
    \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
    \expandafter\c@lor@to@ps\csname\string\color@#1#2\endcsname\@@
  \fi
  \space}
%    \end{macrocode}
%
% For compatibility reasons, we need the following command temporarily; however, |\XC@c@lor@to@ps| will disappear!
%    \begin{macrocode}
\let\XC@c@lor@to@ps\XC@usecolor
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\let\pst@getcolor\XC@getcolor
\let\pst@usecolor\XC@usecolor
%    \end{macrocode}
%
%
% \subsubsection{Whatsit \ldots}
%
% \begin{macro}{\c@lor@special}
% Some drivers do not support all the features of this package.
% They should always put a \Meta{whatsit} in the current list though.
% The following macro has most of the features of |\special|, but does not put anything into the \File{.dvi} file.
% It does write to the |log| file or the terminal (depending on the value of |#1|).
%    \begin{macrocode}
\def\c@lor@special#1#2{\edef\@tempa{\write#1{#2}}\@tempa}
%    \end{macrocode}
%  \end{macro}
%
%
% \subsubsection{Default color}
%
% \begin{macro}{\normalcolor}
% |\normalcolor| is defined (to |\relax|) in the \LaTeX\ kernel, so it is safe to use this in macros that may possibly be used in conjunction with color.
% It will have no effect until the \XCP{} is also loaded.
%    \begin{macrocode}
\def\normalcolor{\let\current@color\default@color\set@color}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\default@color}
% Internal macro to store the `default' color used by |\normalcolor|.
%    \begin{macrocode}
\AtBeginDocument{\let\default@color\current@color}
%    \end{macrocode}
% \end{macro}
% |\current@color| (which is the expansion of |\XC@current@color|) contains an internal representation of the color at this point in the document.
% This can only be an approximation to the truth as the `macro layer' of \TeX\ does not know where the output routine is going to re-insert floats.
% This is why drivers must maintain their own stack of colors in order to fully support these commands.
%
%
% \subsubsection{Driver-specific definitions for named colors}
%
% \begin{macro}{\c@lor@@named}
% \begin{macro}{\define@color@named}
% We have to modify a few driver-specific commands in order to avoid generation of superfluous macros.
%    \begin{macrocode}
\XC@ifcase\XC@@drv
 {{dvipdf,dvipdfm,dvipdfmx,dvips,pctex32}%
  {\def\c@lor@@named#1,#2,#3\@@#4%
    {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive
             \csname\string\color@#1\endcsname}}
   \def\define@color@named#1#2%
    {\@namedef{\string\color@#1}{{}{}{ \colornameprefix#1}{}{}}}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  {dvipsone,luatex,pctexps,pdftex,tcidvi,truetex,vtex,xetex}%
  {\def\c@lor@@named#1,#2,#3\@@#4%
    {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive
             \csname\string\color@#1\endcsname}}
   \def\define@color@named#1#2%
    {\let\@@cls\@empty\@namedef{\string\color@#1}{{}{}{#2}{}{}}}}%
%    \end{macrocode}
%
%    \begin{macrocode}
  {textures}%
  {\def\c@lor@@named#1,#2,#3\@@#4%
    {\edef\@tempa{\color@P@custom{#1}{\if!#2!1\else#2\fi}}%
     \expandafter\def\expandafter#4\@tempa}
   \def\define@color@named#1#2%
    {\edef\@tempa{{#1}{#2}}\expandafter\AddCustomColor\@tempa}
   \def\c@lor@ps@#1 #2\@@
    {\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\c@lor@to@ps@
     \csname\string\color@#1\expandafter\endcsname\space
     #2. \@@{#1}}}%
%    \end{macrocode}
%
%    \begin{macrocode}
 }{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Basic color definitions}
%
% \Model{rgb}-minded colors.\footnote{Generic definitions:
% \Color{brown} = \Color{violet}|!|50|!|\Color{yellow},
% \Color{lime} = \Color{green}|!|25|!|\Color{yellow},
% \Color{orange} = \Color{red}|!|50|!|\Color{yellow},
% \Color{pink} = \Color{red}|!|25,
% \Color{purple} = \Color{violet}|!|50|!|\Color{red},
% \Color{teal} = \Color{green}|!|50|!|\Color{blue},
% \Color{violet} = \Color{blue}|!|50|!|\Color{red}.}
%    \begin{macrocode}
\definecolorset{rgb/hsb/cmyk/gray}{}{}%
 {red,1,0,0/0,1,1/0,1,1,0/.3;%
  green,0,1,0/.33333,1,1/1,0,1,0/.59;%
  blue,0,0,1/.66667,1,1/1,1,0,0/.11;%
  brown,.75,.5,.25/.083333,.66667,.75/0,.25,.5,.25/.5475;%
  lime,.75,1,0/.20833,1,1/.25,0,1,0/.815;%
  orange,1,.5,0/.083333,1,1/0,.5,1,0/.595;%
  pink,1,.75,.75/0,.25,1/0,.25,.25,0/.825;%
  purple,.75,0,.25/.94444,1,.75/0,.75,.5,.25/.2525;%
  teal,0,.5,.5/.5,1,.5/.5,0,0,.5/.35;%
  violet,.5,0,.5/.83333,1,.5/0,.5,0,.5/.205}%
%    \end{macrocode}
%
% \Model{cmyk}-minded colors.\footnote{Generic definitions:
% \Color{olive} = \Color{red}|!|50|!|\Color{green}.}
%    \begin{macrocode}
\definecolorset{cmyk/rgb/hsb/gray}{}{}%
 {cyan,1,0,0,0/0,1,1/.5,1,1/.7;%
  magenta,0,1,0,0/1,0,1/.83333,1,1/.41;%
  yellow,0,0,1,0/1,1,0/.16667,1,1/.89;%
  olive,0,0,1,.5/.5,.5,0/.16667,1,.5/.39}
%    \end{macrocode}
%
% \Model{gray}-minded colors.
%    \begin{macrocode}
\definecolorset{gray/rgb/hsb/cmyk}{}{}%
 {black,0/0,0,0/0,0,0/0,0,0,1;%
  darkgray,.25/.25,.25,.25/0,0,.25/0,0,0,.75;%
  gray,.5/.5,.5,.5/0,0,.5/0,0,0,.5;%
  lightgray,.75/.75,.75,.75/0,0,.75/0,0,0,.25;%
  white,1/1,1,1/0,0,1/0,0,0,0}
%    \end{macrocode}
%
% Load predefined sets of colors (e.g., \File{dvipsnam.def}).
%    \begin{macrocode}
\XC@@names
%    \end{macrocode}
%
%
% \subsubsection{Finale}
%
% Clear color stack and restore catcodes.
%    \begin{macrocode}
\AtBeginDocument{\let\XC@@stack\@empty}
\let\colornameprefix\XC@@nameprefix
\XC@catcodes
%    \end{macrocode}
%
%    \begin{macrocode}
\csname xcolorcmd\endcsname
\color{black}
%</package>
%    \end{macrocode}
%
%
% \iffalse
%-------------------------------------------------------------------------------
% \fi
%
% \subsection{Auxiliary definitions}
%
% \subsubsection{\Index{PostScript} prologue file \File{xcolor.pro}}
%
%    \begin{macrocode}
%<*dvips>
userdict begin
/setcmycolor{0 setcmykcolor}def
/XCbd{bind def}bind def
/XCed{exch def}XCbd
%    \end{macrocode}
%
% \Index{PostScript} version of |\providecommand|.
%    \begin{macrocode}
/XCdef{exch dup TeXDict exch known{pop pop}{XCed}ifelse}XCbd
%    \end{macrocode}
%
% \Index{PostScript} version of |\providecolor|.
%    \begin{macrocode}
/XCsetcolor{cvx counttomark array astore cvx exch pop XCdef}XCbd
%    \end{macrocode}
%
% Now define model-dependent color definition commands.
%    \begin{macrocode}
/XCcmy{mark exch exec/setcmycolor XCsetcolor}XCbd
/XCcmyk{mark exch exec/setcmykcolor XCsetcolor}XCbd
/XCgray{mark exch exec/setgray XCsetcolor}XCbd
/XChsb{mark exch exec/sethsbcolor XCsetcolor}XCbd
/XCrgb{mark exch exec/setrgbcolor XCsetcolor}XCbd
%    \end{macrocode}
%
% This is a fix for \File{special.pro}'s behaviour to perform a |0 setgray| during |normalscale|.
%    \begin{macrocode}
/XCfixnormalscale{/normalscale{Resolution 72 div VResolution 72 div neg
  scale magscale{DVImag dup scale}if}def}def
%    \end{macrocode}
%
% Grouping operators.
% We have to call |XCfixnormalscale| since |normalscale| is invoked by |@beginspecial| as defined by \File{special.pro}.
%    \begin{macrocode}
/XC!b{save XCfixnormalscale}XCbd
/XC!e{restore}XCbd
%    \end{macrocode}
%
% Scale `sp' coordinates back to `bp' units.
%    \begin{macrocode}
/XCsp2bp{1 65781.76 div dup scale}XCbd
%    \end{macrocode}
%
% \begin{macro}{XCsetline}
%   \meta{linewidth} |XCsetline|\\
% Common line definition.
%    \begin{macrocode}
/XCsetline
 {setlinewidth [] 0 setdash 2 setlinecap 0 setlinejoin 4 setmiterlimit}XCbd
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{XCboxframe}
%   \meta{linewidth} \meta{width} \meta{height} \meta{depth} |XCboxframe|\\
% Draw a frame in `sp' coordinates using LanguageLevel~2.
%    \begin{macrocode}
/XCboxframe{/d XCed/h XCed/w XCed/l XCed w 0 gt{h d neg gt{l 0 gt
 {XCsp2bp l XCsetline
  l 2 div dup translate
  0 d neg w l sub h l sub d add rectstroke}if}if}if}XCbd
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{XCcolorblock}
%   \meta{width} \meta{height} \meta{depth} |XCcolorblock|\\
% Draw a colored box in `sp' coordinates using LanguageLevel~2.
%    \begin{macrocode}
/XCcolorblock{/d XCed/h XCed/w XCed w 0 gt{h d neg gt
 {XCsp2bp 0 XCsetline
  0 d neg w h d add rectfill}if}if}XCbd
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
end
%</dvips>
%    \end{macrocode}
%
%
% \clearpage
% \Finale
% \endinput
%
%
% \iffalse
%-------------------------------------------------------------------------------
%<*svgnames|x11names|hksknames|hksnnames|hksznames|pmsnames|ralnames>
\def\colornameprefix{XC@}
%</svgnames|x11names|hksknames|hksnnames|hksznames|pmsnames|ralnames>
%
%<*svgnames>
\preparecolorset{rgb}{}{}{%
AliceBlue,.94,.972,1;%
AntiqueWhite,.98,.92,.844;%
Aqua,0,1,1;%
Aquamarine,.498,1,.83;%
Azure,.94,1,1;%
Beige,.96,.96,.864;%
Bisque,1,.894,.77;%
Black,0,0,0;%
BlanchedAlmond,1,.92,.804;%
Blue,0,0,1;%
BlueViolet,.54,.17,.888;%
Brown,.648,.165,.165;%
BurlyWood,.87,.72,.53;%
CadetBlue,.372,.62,.628;%
Chartreuse,.498,1,0;%
Chocolate,.824,.41,.116;%
Coral,1,.498,.312;%
CornflowerBlue,.392,.585,.93;%
Cornsilk,1,.972,.864;%
Crimson,.864,.08,.235;%
Cyan,0,1,1;%
DarkBlue,0,0,.545;%
DarkCyan,0,.545,.545;%
DarkGoldenrod,.72,.525,.044;%
DarkGray,.664,.664,.664;%
DarkGreen,0,.392,0;%
DarkGrey,.664,.664,.664;%
DarkKhaki,.74,.716,.42;%
DarkMagenta,.545,0,.545;%
DarkOliveGreen,.332,.42,.185;%
DarkOrange,1,.55,0;%
DarkOrchid,.6,.196,.8;%
DarkRed,.545,0,0;%
DarkSalmon,.912,.59,.48;%
DarkSeaGreen,.56,.736,.56;%
DarkSlateBlue,.284,.24,.545;%
DarkSlateGray,.185,.31,.31;%
DarkSlateGrey,.185,.31,.31;%
DarkTurquoise,0,.808,.82;%
DarkViolet,.58,0,.828;%
DeepPink,1,.08,.576;%
DeepSkyBlue,0,.75,1;%
DimGray,.41,.41,.41;%
DimGrey,.41,.41,.41;%
DodgerBlue,.116,.565,1;%
FireBrick,.698,.132,.132;%
FloralWhite,1,.98,.94;%
ForestGreen,.132,.545,.132;%
Fuchsia,1,0,1;%
Gainsboro,.864,.864,.864;%
GhostWhite,.972,.972,1;%
Gold,1,.844,0;%
Goldenrod,.855,.648,.125;%
Gray,.5,.5,.5;%
Green,0,.5,0;%
GreenYellow,.68,1,.185;%
Grey,.5,.5,.5;%
Honeydew,.94,1,.94;%
HotPink,1,.41,.705;%
IndianRed,.804,.36,.36;%
Indigo,.294,0,.51;%
Ivory,1,1,.94;%
Khaki,.94,.9,.55;%
Lavender,.9,.9,.98;%
LavenderBlush,1,.94,.96;%
LawnGreen,.488,.99,0;%
LemonChiffon,1,.98,.804;%
LightBlue,.68,.848,.9;%
LightCoral,.94,.5,.5;%
LightCyan,.88,1,1;%
LightGoldenrod,.933,.867,.51;%
LightGoldenrodYellow,.98,.98,.824;%
LightGray,.828,.828,.828;%
LightGreen,.565,.932,.565;%
LightGrey,.828,.828,.828;%
LightPink,1,.712,.756;%
LightSalmon,1,.628,.48;%
LightSeaGreen,.125,.698,.668;%
LightSkyBlue,.53,.808,.98;%
LightSlateBlue,.518,.44,1;%
LightSlateGray,.468,.532,.6;%
LightSlateGrey,.468,.532,.6;%
LightSteelBlue,.69,.77,.87;%
LightYellow,1,1,.88;%
Lime,0,1,0;%
LimeGreen,.196,.804,.196;%
Linen,.98,.94,.9;%
Magenta,1,0,1;%
Maroon,.5,0,0;%
MediumAquamarine,.4,.804,.668;%
MediumBlue,0,0,.804;%
MediumOrchid,.73,.332,.828;%
MediumPurple,.576,.44,.86;%
MediumSeaGreen,.235,.7,.444;%
MediumSlateBlue,.484,.408,.932;%
MediumSpringGreen,0,.98,.604;%
MediumTurquoise,.284,.82,.8;%
MediumVioletRed,.78,.084,.52;%
MidnightBlue,.098,.098,.44;%
MintCream,.96,1,.98;%
MistyRose,1,.894,.884;%
Moccasin,1,.894,.71;%
NavajoWhite,1,.87,.68;%
Navy,0,0,.5;%
NavyBlue,0,0,.5;%
OldLace,.992,.96,.9;%
Olive,.5,.5,0;%
OliveDrab,.42,.556,.136;%
Orange,1,.648,0;%
OrangeRed,1,.27,0;%
Orchid,.855,.44,.84;%
PaleGoldenrod,.932,.91,.668;%
PaleGreen,.596,.985,.596;%
PaleTurquoise,.688,.932,.932;%
PaleVioletRed,.86,.44,.576;%
PapayaWhip,1,.936,.835;%
PeachPuff,1,.855,.725;%
Peru,.804,.52,.248;%
Pink,1,.752,.796;%
Plum,.868,.628,.868;%
PowderBlue,.69,.88,.9;%
Purple,.5,0,.5;%
Red,1,0,0;%
RosyBrown,.736,.56,.56;%
RoyalBlue,.255,.41,.884;%
SaddleBrown,.545,.27,.075;%
Salmon,.98,.5,.448;%
SandyBrown,.956,.644,.376;%
SeaGreen,.18,.545,.34;%
Seashell,1,.96,.932;%
Sienna,.628,.32,.176;%
Silver,.752,.752,.752;%
SkyBlue,.53,.808,.92;%
SlateBlue,.415,.352,.804;%
SlateGray,.44,.5,.565;%
SlateGrey,.44,.5,.565;%
Snow,1,.98,.98;%
SpringGreen,0,1,.498;%
SteelBlue,.275,.51,.705;%
Tan,.824,.705,.55;%
Teal,0,.5,.5;%
Thistle,.848,.75,.848;%
Tomato,1,.39,.28;%
Turquoise,.25,.88,.815;%
Violet,.932,.51,.932;%
VioletRed,.816,.125,.565;%
Wheat,.96,.87,.7;%
White,1,1,1;%
WhiteSmoke,.96,.96,.96;%
Yellow,1,1,0;%
YellowGreen,.604,.804,.196}
%</svgnames>
%
%<*x11names>
\preparecolorset{rgb}{}{}{%
AntiqueWhite1,1,.936,.86;%
AntiqueWhite2,.932,.875,.8;%
AntiqueWhite3,.804,.752,.69;%
AntiqueWhite4,.545,.512,.47;%
Aquamarine1,.498,1,.83;%
Aquamarine2,.464,.932,.776;%
Aquamarine3,.4,.804,.668;%
Aquamarine4,.27,.545,.455;%
Azure1,.94,1,1;%
Azure2,.88,.932,.932;%
Azure3,.756,.804,.804;%
Azure4,.512,.545,.545;%
Bisque1,1,.894,.77;%
Bisque2,.932,.835,.716;%
Bisque3,.804,.716,.62;%
Bisque4,.545,.49,.42;%
Blue1,0,0,1;%
Blue2,0,0,.932;%
Blue3,0,0,.804;%
Blue4,0,0,.545;%
Brown1,1,.25,.25;%
Brown2,.932,.23,.23;%
Brown3,.804,.2,.2;%
Brown4,.545,.136,.136;%
Burlywood1,1,.828,.608;%
Burlywood2,.932,.772,.57;%
Burlywood3,.804,.668,.49;%
Burlywood4,.545,.45,.332;%
CadetBlue1,.596,.96,1;%
CadetBlue2,.556,.898,.932;%
CadetBlue3,.48,.772,.804;%
CadetBlue4,.325,.525,.545;%
Chartreuse1,.498,1,0;%
Chartreuse2,.464,.932,0;%
Chartreuse3,.4,.804,0;%
Chartreuse4,.27,.545,0;%
Chocolate1,1,.498,.14;%
Chocolate2,.932,.464,.13;%
Chocolate3,.804,.4,.112;%
Chocolate4,.545,.27,.075;%
Coral1,1,.448,.336;%
Coral2,.932,.415,.312;%
Coral3,.804,.356,.27;%
Coral4,.545,.244,.185;%
Cornsilk1,1,.972,.864;%
Cornsilk2,.932,.91,.804;%
Cornsilk3,.804,.785,.694;%
Cornsilk4,.545,.532,.47;%
Cyan1,0,1,1;%
Cyan2,0,.932,.932;%
Cyan3,0,.804,.804;%
Cyan4,0,.545,.545;%
DarkGoldenrod1,1,.725,.06;%
DarkGoldenrod2,.932,.68,.055;%
DarkGoldenrod3,.804,.585,.048;%
DarkGoldenrod4,.545,.396,.03;%
DarkOliveGreen1,.792,1,.44;%
DarkOliveGreen2,.736,.932,.408;%
DarkOliveGreen3,.635,.804,.352;%
DarkOliveGreen4,.43,.545,.24;%
DarkOrange1,1,.498,0;%
DarkOrange2,.932,.464,0;%
DarkOrange3,.804,.4,0;%
DarkOrange4,.545,.27,0;%
DarkOrchid1,.75,.244,1;%
DarkOrchid2,.698,.228,.932;%
DarkOrchid3,.604,.196,.804;%
DarkOrchid4,.408,.132,.545;%
DarkSeaGreen1,.756,1,.756;%
DarkSeaGreen2,.705,.932,.705;%
DarkSeaGreen3,.608,.804,.608;%
DarkSeaGreen4,.41,.545,.41;%
DarkSlateGray1,.592,1,1;%
DarkSlateGray2,.552,.932,.932;%
DarkSlateGray3,.475,.804,.804;%
DarkSlateGray4,.32,.545,.545;%
DeepPink1,1,.08,.576;%
DeepPink2,.932,.07,.536;%
DeepPink3,.804,.064,.464;%
DeepPink4,.545,.04,.312;%
DeepSkyBlue1,0,.75,1;%
DeepSkyBlue2,0,.698,.932;%
DeepSkyBlue3,0,.604,.804;%
DeepSkyBlue4,0,.408,.545;%
DodgerBlue1,.116,.565,1;%
DodgerBlue2,.11,.525,.932;%
DodgerBlue3,.094,.455,.804;%
DodgerBlue4,.064,.305,.545;%
Firebrick1,1,.19,.19;%
Firebrick2,.932,.172,.172;%
Firebrick3,.804,.15,.15;%
Firebrick4,.545,.1,.1;%
Gold1,1,.844,0;%
Gold2,.932,.79,0;%
Gold3,.804,.68,0;%
Gold4,.545,.46,0;%
Goldenrod1,1,.756,.145;%
Goldenrod2,.932,.705,.132;%
Goldenrod3,.804,.608,.112;%
Goldenrod4,.545,.41,.08;%
Green1,0,1,0;%
Green2,0,.932,0;%
Green3,0,.804,0;%
Green4,0,.545,0;%
Honeydew1,.94,1,.94;%
Honeydew2,.88,.932,.88;%
Honeydew3,.756,.804,.756;%
Honeydew4,.512,.545,.512;%
HotPink1,1,.43,.705;%
HotPink2,.932,.415,.655;%
HotPink3,.804,.376,.565;%
HotPink4,.545,.228,.385;%
IndianRed1,1,.415,.415;%
IndianRed2,.932,.39,.39;%
IndianRed3,.804,.332,.332;%
IndianRed4,.545,.228,.228;%
Ivory1,1,1,.94;%
Ivory2,.932,.932,.88;%
Ivory3,.804,.804,.756;%
Ivory4,.545,.545,.512;%
Khaki1,1,.965,.56;%
Khaki2,.932,.9,.52;%
Khaki3,.804,.776,.45;%
Khaki4,.545,.525,.305;%
LavenderBlush1,1,.94,.96;%
LavenderBlush2,.932,.88,.898;%
LavenderBlush3,.804,.756,.772;%
LavenderBlush4,.545,.512,.525;%
LemonChiffon1,1,.98,.804;%
LemonChiffon2,.932,.912,.75;%
LemonChiffon3,.804,.79,.648;%
LemonChiffon4,.545,.536,.44;%
LightBlue1,.75,.936,1;%
LightBlue2,.698,.875,.932;%
LightBlue3,.604,.752,.804;%
LightBlue4,.408,.512,.545;%
LightCyan1,.88,1,1;%
LightCyan2,.82,.932,.932;%
LightCyan3,.705,.804,.804;%
LightCyan4,.48,.545,.545;%
LightGoldenrod1,1,.925,.545;%
LightGoldenrod2,.932,.864,.51;%
LightGoldenrod3,.804,.745,.44;%
LightGoldenrod4,.545,.505,.298;%
LightPink1,1,.684,.725;%
LightPink2,.932,.635,.68;%
LightPink3,.804,.55,.585;%
LightPink4,.545,.372,.396;%
LightSalmon1,1,.628,.48;%
LightSalmon2,.932,.585,.448;%
LightSalmon3,.804,.505,.385;%
LightSalmon4,.545,.34,.26;%
LightSkyBlue1,.69,.888,1;%
LightSkyBlue2,.644,.828,.932;%
LightSkyBlue3,.552,.712,.804;%
LightSkyBlue4,.376,.484,.545;%
LightSteelBlue1,.792,.884,1;%
LightSteelBlue2,.736,.824,.932;%
LightSteelBlue3,.635,.71,.804;%
LightSteelBlue4,.43,.484,.545;%
LightYellow1,1,1,.88;%
LightYellow2,.932,.932,.82;%
LightYellow3,.804,.804,.705;%
LightYellow4,.545,.545,.48;%
Magenta1,1,0,1;%
Magenta2,.932,0,.932;%
Magenta3,.804,0,.804;%
Magenta4,.545,0,.545;%
Maroon1,1,.204,.7;%
Maroon2,.932,.19,.655;%
Maroon3,.804,.16,.565;%
Maroon4,.545,.11,.385;%
MediumOrchid1,.88,.4,1;%
MediumOrchid2,.82,.372,.932;%
MediumOrchid3,.705,.32,.804;%
MediumOrchid4,.48,.215,.545;%
MediumPurple1,.67,.51,1;%
MediumPurple2,.624,.475,.932;%
MediumPurple3,.536,.408,.804;%
MediumPurple4,.365,.28,.545;%
MistyRose1,1,.894,.884;%
MistyRose2,.932,.835,.824;%
MistyRose3,.804,.716,.71;%
MistyRose4,.545,.49,.484;%
NavajoWhite1,1,.87,.68;%
NavajoWhite2,.932,.81,.63;%
NavajoWhite3,.804,.7,.545;%
NavajoWhite4,.545,.475,.37;%
OliveDrab1,.752,1,.244;%
OliveDrab2,.7,.932,.228;%
OliveDrab3,.604,.804,.196;%
OliveDrab4,.41,.545,.132;%
Orange1,1,.648,0;%
Orange2,.932,.604,0;%
Orange3,.804,.52,0;%
Orange4,.545,.352,0;%
OrangeRed1,1,.27,0;%
OrangeRed2,.932,.25,0;%
OrangeRed3,.804,.215,0;%
OrangeRed4,.545,.145,0;%
Orchid1,1,.512,.98;%
Orchid2,.932,.48,.912;%
Orchid3,.804,.41,.79;%
Orchid4,.545,.28,.536;%
PaleGreen1,.604,1,.604;%
PaleGreen2,.565,.932,.565;%
PaleGreen3,.488,.804,.488;%
PaleGreen4,.33,.545,.33;%
PaleTurquoise1,.732,1,1;%
PaleTurquoise2,.684,.932,.932;%
PaleTurquoise3,.59,.804,.804;%
PaleTurquoise4,.4,.545,.545;%
PaleVioletRed1,1,.51,.67;%
PaleVioletRed2,.932,.475,.624;%
PaleVioletRed3,.804,.408,.536;%
PaleVioletRed4,.545,.28,.365;%
PeachPuff1,1,.855,.725;%
PeachPuff2,.932,.796,.68;%
PeachPuff3,.804,.688,.585;%
PeachPuff4,.545,.468,.396;%
Pink1,1,.71,.772;%
Pink2,.932,.664,.72;%
Pink3,.804,.57,.62;%
Pink4,.545,.39,.424;%
Plum1,1,.732,1;%
Plum2,.932,.684,.932;%
Plum3,.804,.59,.804;%
Plum4,.545,.4,.545;%
Purple1,.608,.19,1;%
Purple2,.57,.172,.932;%
Purple3,.49,.15,.804;%
Purple4,.332,.1,.545;%
Red1,1,0,0;%
Red2,.932,0,0;%
Red3,.804,0,0;%
Red4,.545,0,0;%
RosyBrown1,1,.756,.756;%
RosyBrown2,.932,.705,.705;%
RosyBrown3,.804,.608,.608;%
RosyBrown4,.545,.41,.41;%
RoyalBlue1,.284,.464,1;%
RoyalBlue2,.264,.43,.932;%
RoyalBlue3,.228,.372,.804;%
RoyalBlue4,.152,.25,.545;%
Salmon1,1,.55,.41;%
Salmon2,.932,.51,.385;%
Salmon3,.804,.44,.33;%
Salmon4,.545,.298,.224;%
SeaGreen1,.33,1,.624;%
SeaGreen2,.305,.932,.58;%
SeaGreen3,.264,.804,.5;%
SeaGreen4,.18,.545,.34;%
Seashell1,1,.96,.932;%
Seashell2,.932,.898,.87;%
Seashell3,.804,.772,.75;%
Seashell4,.545,.525,.51;%
Sienna1,1,.51,.28;%
Sienna2,.932,.475,.26;%
Sienna3,.804,.408,.224;%
Sienna4,.545,.28,.15;%
SkyBlue1,.53,.808,1;%
SkyBlue2,.494,.752,.932;%
SkyBlue3,.424,.65,.804;%
SkyBlue4,.29,.44,.545;%
SlateBlue1,.512,.435,1;%
SlateBlue2,.48,.404,.932;%
SlateBlue3,.41,.35,.804;%
SlateBlue4,.28,.235,.545;%
SlateGray1,.776,.888,1;%
SlateGray2,.725,.828,.932;%
SlateGray3,.624,.712,.804;%
SlateGray4,.424,.484,.545;%
Snow1,1,.98,.98;%
Snow2,.932,.912,.912;%
Snow3,.804,.79,.79;%
Snow4,.545,.536,.536;%
SpringGreen1,0,1,.498;%
SpringGreen2,0,.932,.464;%
SpringGreen3,0,.804,.4;%
SpringGreen4,0,.545,.27;%
SteelBlue1,.39,.72,1;%
SteelBlue2,.36,.675,.932;%
SteelBlue3,.31,.58,.804;%
SteelBlue4,.21,.392,.545;%
Tan1,1,.648,.31;%
Tan2,.932,.604,.288;%
Tan3,.804,.52,.248;%
Tan4,.545,.352,.17;%
Thistle1,1,.884,1;%
Thistle2,.932,.824,.932;%
Thistle3,.804,.71,.804;%
Thistle4,.545,.484,.545;%
Tomato1,1,.39,.28;%
Tomato2,.932,.36,.26;%
Tomato3,.804,.31,.224;%
Tomato4,.545,.21,.15;%
Turquoise1,0,.96,1;%
Turquoise2,0,.898,.932;%
Turquoise3,0,.772,.804;%
Turquoise4,0,.525,.545;%
VioletRed1,1,.244,.59;%
VioletRed2,.932,.228,.55;%
VioletRed3,.804,.196,.47;%
VioletRed4,.545,.132,.32;%
Wheat1,1,.905,.73;%
Wheat2,.932,.848,.684;%
Wheat3,.804,.73,.59;%
Wheat4,.545,.494,.4;%
Yellow1,1,1,0;%
Yellow2,.932,.932,0;%
Yellow3,.804,.804,0;%
Yellow4,.545,.545,0;%
Gray0,.745,.745,.745;%
Green0,0,1,0;%
Grey0,.745,.745,.745;%
Maroon0,.69,.19,.376;%
Purple0,.628,.125,.94}
%</x11names>
%
%<*test1>
\documentclass[a4paper]{article}

\usepackage{array,multicol,multido,textcomp}
\usepackage{xcolor}[2005/03/24]
\usepackage[hmargin={1.25cm,.75cm},vmargin=1.25cm,footskip=.5cm,nohead]{geometry}

\newdimen\Argwd
\newdimen\Errsum
\newdimen\Errmax
\newcount\Colors
\newcount\Errors
\newcount\Loops
\newif\ifColor

\makeatletter

\def\DisplayColor#1#2#3%
 {\global\advance\Loops\@ne
  \@tempdima=#1\p@ \edef\@tempa{\the\@tempdima}%
  \edef\Colori{\strip@pt\@tempdima}%
  \ifColor
    \@tempdimb=#2\p@ \edef\@tempb{\the\@tempdimb}%
    \@tempdimc=#3\p@ \edef\@tempc{\the\@tempdimc}%
    \edef\Colori{\Colori,\strip@pt\@tempdimb,\strip@pt\@tempdimc}%
  \fi
  \Make12\Make23\Make34\Make45\Make56\Make67%
  \begin{tabular}{@{}ll*4{@{ }p{\Argwd}}@{}}
  \Row1\Row2\Row3\Row4\Row5\Row6\noalign{\medskip}
  \end{tabular}
  \global\advance\Colors1 \relax\ifnum\Colors=30 \newpage\global\Colors=0 \fi}

\def\Make#1#2%
 {\edef\@@tmp
   {\noexpand\definecolor{Color\romannumeral#1}%
     {\@nameuse{Model\romannumeral#1}}{\@nameuse{Color\romannumeral#1}}%
   }\@@tmp
  \relax\ifnum#1<6
    \convertcolorspec
     {\@nameuse{Model\romannumeral#1}}{\@nameuse{Color\romannumeral#1}}%
     {\@nameuse{Model\romannumeral#2}}\@@tmp
    \XC@let@cN{Color\romannumeral#2}\@@tmp
  \fi}
\def\Row#1%
 {\edef\@@tmp{\@nameuse{Color\romannumeral#1}\@nameuse{Row\romannumeral#1}}%
  \expandafter\@Row\@@tmp}

\def\@Row#1,#2,#3,#4,#5#6%
 {\fcolorbox{black}{Color\romannumeral#5}{\phantom{000}}&
  \csname Model\romannumeral#5\endcsname &
  \ifodd#6 \@Error{#1}\@tempa \else #1\fi &
  \ifColor\ifodd#6 \@Error{#2}\@tempb \else #2\fi\else #2\fi &
  \ifColor\ifodd#6 \@Error{#3}\@tempc \else #3\fi\else #3\fi &
  #4\\}

\def\defModel#1#2#3#4% number, name, commas, check
 {\@namedef{Model\romannumeral#1}{#2}\@namedef{Row\romannumeral#1}{#3#1#4}}

\def\@Error#1#2%
 {\ifdim#1\p@=#2\relax #1\else
    \textcolor{red}{#1}\global\advance\Errors\@ne
    \dimen@#2\advance\dimen@-#1\p@ \ifdim\dimen@<\z@\dimen@-\dimen@\fi
    \global\advance\Errsum\dimen@
    \ifdim\dimen@>\Errmax \global\Errmax\dimen@
      \dimen@\@tempa \edef\@@tempa{\strip@pt\dimen@}%
      \ifColor
        \dimen@\@tempb \edef\@@tempb{\strip@pt\dimen@}%
        \dimen@\@tempc \edef\@@tempc{\strip@pt\dimen@}%
        \xdef\Errcase{\@@tempa\noexpand~\@@tempb\noexpand~\@@tempc}%
      \else
        \xdef\Errcase{\@@tempa}%
      \fi
    \fi
  \fi}

\newenvironment{ColorTest}[1]%
 {\addcontentsline{toc}{section}{Color conversion chain: #1}
  \Colors\z@ \Errors\z@ \Loops\z@ \Errsum\z@ \Errmax\z@
  \begin{multicols}{3}\centering}%
 {\end{multicols}\bigskip
  \begin{tabular}{@{}l@{ = }l@{}}
  \multicolumn2{@{}l@{}}{Rounding error statistics of color conversion test}\\
  \multicolumn2{@{}l@{}}%
   {$\textbf\Modeli\rightarrow \textbf\Modelii\rightarrow \textbf\Modeliii\rightarrow
     \textbf\Modeliv\rightarrow \textbf\Modelv\rightarrow \textbf\Modelvi$:}\\[1ex]
  number of examples& \number\Loops\\
  number of errors& \number\Errors\\
  sum of absolute errors& \strip@pt\Errsum\\
  \ifnum\Errors>\z@
    average error& \Errsum100\Errsum \dimen@\Errors\p@ \divide\dimen@\@m
    \rdivide\Errsum\dimen@ \strip@pt\Errsum\textperiodcentered10\textsuperscript{-5}\\
    maximum error& \strip@pt\Errmax{} @ \Modeli~\Errcase\\
  \fi
  \end{tabular}\newpage}

\def\thepage{\sffamily\footnotesize\@nameuse{@arabic}\c@page}

\makeatother

\parindent0pt
\setcounter{secnumdepth}{-1}

\begin{document}

\title{Color conversion with the \textsf{xcolor} package --- Examples}
\author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{xcolor@ukern.de}.}}
\date{\XCfileversion{} (\XCfiledate)}
\maketitle

\begin{center}
\begin{minipage}{.75\textwidth}
\tableofcontents
\end{minipage}
\end{center}
\newpage

\sffamily\footnotesize
\fboxrule.25pt
\settowidth\Argwd{0.00000}

\defModel1{rgb}{,,}0
\defModel2{cmy}{,,}0
\defModel3{cmyk}{,}0
\defModel4{hsb}{,,}0
\defModel5{rgb}{,,}1
\defModel6{gray}{,,,,}0
\Colortrue

\begin{ColorTest}{rgb, cmy, cmyk, hsb, rgb, gray}
\multido{\nR=1+-.1}{11}%
 {\multido{\nG=1+-.1}{11}%
  {\multido{\nB=1+-.1}{11}%
   {\DisplayColor{\nR}{\nG}{\nB}}}}%
\end{ColorTest}

\defModel1{gray}{,,,,}0
\defModel2{rgb}{,,}0
\defModel3{cmy}{,,}0
\defModel4{cmyk}{,}0
\defModel5{hsb}{,,}0
\defModel6{gray}{,,,,}1
\Colorfalse

\begin{ColorTest}{gray, rgb, cmy, cmyk, hsb, gray}
\multido{\nG=1+-.01}{101}{\DisplayColor{\nG}{}{}}%
\end{ColorTest}

\end{document}
%</test1>
%
%<*test2>
\listfiles
\documentclass{article}

\usepackage{pstricks,pst-tree,pst-slpe,multido}
\makeatletter
\makeatother
\usepackage{fvrb-ex}

\def\textfraction{0.01}
\def\topfraction{0.99}
\def\bottomfraction{0.99}
\def\floatpagefraction{0.70}
\setlength\abovecaptionskip{12pt}
\setlength\belowcaptionskip{10pt}
\parindent0pt

\begin{document}
\title{Color extensions with the \textsf{xcolor} package --- \textsf{pstricks} examples}
\author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{xcolor@ukern.de}.}}
\date{\XCfileversion{} (\XCfiledate)}
\maketitle

\centerline{\fcolorbox{red}{yellow!50}{This document is not suitable for pdf\LaTeX! Please use \LaTeX{} + \texttt{dvips} etc.}}

\begin{figure}[htb]\caption{Modified version of an example from the \textsf{pstricks} manual; requires \textsf{pst-tree}}
\begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
  \begin{pspicture}(-0.5,-2)(3,2)
  \cnode(0,0){.5cm}{root}
  \cnode*[linecolor=red](3,1.5){4pt}{A}
  \cnode*[linecolor=red!72.5375!blue](3,0){4pt}{B}
  \cnode*[linecolor=-red](3,-1.5){4pt}{C}
  \psset{nodesep=3pt}
  \ncline[linecolor=green!50!red]{root}{A}
  \ncline[linecolor=blue]{root}{B}
  \ncline[linecolor=-green!50!red]{root}{C}
  \end{pspicture}
\end{SideBySideExample}
\end{figure}

\begin{figure}[htb]\caption{Moving from one color to its complement; requires \textsf{pst-slpe}}
\begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
  \begin{pspicture}(4,1)
  \psframe[fillstyle=slope,
           slopeangle=30,
           slopebegin=red!72.5375!blue,
           slopeend=-red!72.5375!blue](4,1)
  \end{pspicture}
\end{SideBySideExample}
\end{figure}

\begin{figure}[htb]\caption{Explicit color specification via a loop command; requires \textsf{multido}}
\begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
  \psset{unit=1.75}%
  \begin{pspicture}(0,-1)(2,1)
  \multido{\rHue=0.00+0.01}{100}%
   {\pscircle[linewidth=0.01,
              linecolor={[hsb]{\rHue,1,1}}](1,0){\rHue}}
  \end{pspicture}
\end{SideBySideExample}
\end{figure}

\begin{figure}[htb]\caption{Color series --- modified version of an example from the \textsf{pst-fill} manual; note that the \texttt{\string\multirput} command does not give the desired result here}
\begin{SideBySideExample}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
  \newcommand*\Sheep
   {\begin{pspicture}(3,1.5)
    \pscustom[liftpen=2,fillstyle=solid,fillcolor=sheep!!+]%
     {\pscurve(0.5,-0.2)(0.6,0.5)(0.2,1.3)(0,1.5)(0,1.5)
       (0.4,1.3)(0.8,1.5)(2.2,1.9)(3,1.5)(3,1.5)(3.2,1.3)
       (3.6,0.5)(3.4,-0.3)(3,0)(2.2,0.4)(0.5,-0.2)}
    \pscircle*(2.65,1.25){0.12\psunit}% Eye
    \psccurve*(3.5,0.3)(3.35,0.45)(3.5,0.6)(3.6,0.4)% Muzzle
    \pscurve(3,0.35)(3.3,0.1)(3.6,0.05)% Mouth
    \pscurve(2.3,1.3)(2.1,1.5)(2.15,1.7)
    \pscurve(2.1,1.7)(2.35,1.6)(2.45,1.4)% Ear
    \end{pspicture}}
  \definecolorseries
   {sheep}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
  \resetcolorseries{sheep}
  \psset{unit=0.4}
  \begin{pspicture}(-3,-6)(0,7.5)
  \Multido{\ry=6.0+-1.5}{5}%
   {\rput(0,\ry){\Multido{}{5}{\Sheep}}}
  \resetcolorseries{sheep}%
  \multirput(-6,-6)(3,0)5{\Sheep}
  \end{pspicture}
\end{SideBySideExample}
\end{figure}

\begin{figure}[htb]\caption{Interaction with native PostScript code --- $\gamma$-corrected wavelengths}
\begin{Example}[fontsize=\footnotesize,xrightmargin=.45\textwidth]
  \newcount\WL \unitlength.75pt
  \def\WaveToPS#1%
   {\definecolor{tmp}{rgb:wave}{#1}\extractcolorspecs{tmp}\tmpm\tmpc
    \expandafter\WaveToPSi\tmpc,}
  \def\WaveToPSi#1,#2,#3,{\pstVerb{/Red{#1}def /Green{#2}def /Blue{#3}def}}
  \def\DisplayBar#1#2%
   {\linethickness{1.25\unitlength}\WL=360
    \pstVerb{/Gamma{#1}def}%
    \multiput(360,#2)(1,0){456}%
     {\WaveToPS{\the\WL}{\color{lambda}\line(0,1){50}}\global\advance\WL1}%
    \linethickness{0.25\unitlength}\WL=360
    \multiput(360,#2)(20,0){23}%
     {\picture(0,0)
      \line(0,-1){5}\multiput(5,0)(5,0){3}{\line(0,-1){2.5}}%
      \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
      \endpicture}%
    \put(350,#2){\makebox(0,50)[r]{\small$\gamma$\,=\,#1}}}
  \pstVerb{/Corr{dup 0 gt {Gamma exp}if}def}
  \definecolor[ps]{lambda}{rgb}{Red Corr Green Corr Blue Corr}%
  \begin{picture}(510,345)(310,-10)
  \sffamily\tiny
  \DisplayBar{0.4}{0}%
  \DisplayBar{0.6}{70}%
  \DisplayBar{0.8}{140}%
  \DisplayBar{1.0}{210}%
  \DisplayBar{1.2}{280}%
  \end{picture}
\end{Example}
\end{figure}

\end{document}
%</test2>
%
%<*test3>
\listfiles
\documentclass[a4paper]{article}
\usepackage[showerrors,table,dvipsnames*,hyperref]{xcolor}[2005/12/21]
\usepackage[margin=2.25cm]{geometry}
\usepackage
 [\GinDriver,hyperindex=false,bookmarks,bookmarksopen,bookmarksopenlevel=1,%
  pdftitle={xcolor3 \XCfileversion{} (\XCfiledate)},pdfauthor={Dr. Uwe Kern},%
  pdfsubject={Color extensions for LaTeX and pdfLaTeX},%
  pdfkeywords={xcolor,color,colour,model,tint,tone,shade,harmony,spot,latex,pdftex,dvips,%
   conversion,blend,mix,mask,separation,rgb,cmy,cmyk,hsb,gray,html,wave,thsb,wheel}]{hyperref}

\tracingcolors=4
%%\tracingcolors=3
%%\tracingcolors=2
%%\tracingcolors=1
%%\tracingcolors=0

\parindent0pt
\pagecolor{gray!25}

\definecolors{JungleGreen,DarkOrchid}

\begin{document}
\title{Color extensions with the \textsf{xcolor} package --- various examples}
\author{\href{mailto:xcolor@ukern.de}{\fboxrule0pt\fboxsep2pt\fbox{Dr. Uwe Kern}}}
\date{\XCfileversion{} (\XCfiledate)
\thanks{This file (\texttt{\jobname.tex}) is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors \texttt{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor/}{CTAN/macros/latex/contrib/xcolor/}} or the homepage \texttt{\href{http://www.ukern.de/tex/xcolor.html}{www.ukern.de/tex/xcolor.html}}. Please send error reports and suggestions for improvements to \texttt{\href{mailto:xcolor@ukern.de}{xcolor@ukern.de}}.}}
\maketitle

The purpose of this file is to demonstrate a variety of capabilities including the logging facilities of the \textsf{xcolor} package.
By playing around with different values of \texttt{\string\tracingcolors}, one can observe the different behavior in the \texttt{log} file.

\section{Predefined colors}

\begingroup
\small\sffamily
\rowcolors1{}{}
\begin{testcolors}[rgb,cmyk,hsb,HTML,gray]
\testcolor{red}
\testcolor{green}
\testcolor{blue}
\testcolor{cyan}
\testcolor{magenta}
\testcolor{yellow}
\testcolor{orange}
\testcolor{violet}
\testcolor{purple}
\testcolor{brown}
\testcolor{pink}
\testcolor{olive}
\testcolor{black}
\testcolor{darkgray}
\testcolor{gray}
\testcolor{lightgray}
\testcolor{white}
\noalign{\medskip}\hline\noalign{\medskip}
\testcolor{-red}
\testcolor{-green}
\testcolor{-blue}
\testcolor{-cyan}
\testcolor{-magenta}
\testcolor{-yellow}
\testcolor{-orange}
\testcolor{-violet}
\testcolor{-purple}
\testcolor{-brown}
\testcolor{-pink}
\testcolor{-olive}
\testcolor{-black}
\testcolor{-darkgray}
\testcolor{-gray}
\testcolor{-lightgray}
\testcolor{-white}
\noalign{\medskip}\hline\noalign{\medskip}
\testcolor{JungleGreen}
\testcolor{DarkOrchid}
\noalign{\medskip}\hline\noalign{\medskip}
\testcolor{-JungleGreen}
\testcolor{-DarkOrchid}
\end{testcolors}
\endgroup

\vfill

\clearpage
\nopagecolor
Switch off \texttt{\string\pagecolor} by \texttt{\string\nopagecolor}.
The driver may or may not obey this command \dots

\clearpage
\pagecolor{white}

\section{Color definition and application}

\providecolor{dummy}{rgb}{.6,.5,.4}
\definecolor{dummy}{rgb}{.6,.5,.4}
\providecolor{dummy}{rgb}{.6,.5,.4}
\hbox{\textcolor{dummy}{Test with \texttt{\string\definecolor}}}

\bigskip

Comma-separated and space-separated definitions:

\definecolor{c1}{rgb}{.7,.6,.5}
\definecolor{c2}{rgb}{.7 .6 .5}
\colorlet{c1a}{c1}
\colorlet{c2a}{c2}

\textcolor{c1}{identical} =
\textcolor{c2}{identical} =
\textcolor{c1a}{identical} =
\textcolor{c2a}{identical} =
\textcolor[rgb]{.7,.6,.5}{identical} =
\textcolor[rgb]{.7 .6 .5}{identical} =
\textcolor{rgb,10:red,7;green,6;blue,5}{identical}
\textcolor{rgb,15:red,10.5;green,9;blue,7.5}{identical}

\medskip

\begingroup
\sffamily
\begin{testcolors}
\testcolor{c1}
\testcolor{c2}
\testcolor{c1a}
\testcolor{c2a}
\testcolor[rgb]{.7,.6,.5}
\testcolor[rgb]{.7 .6 .5}
\testcolor{rgb,10:red,7;green,6;blue,5}
\testcolor{rgb,15:red,10.5;green,9;blue,7.5}
\end{testcolors}
\endgroup

\bigskip

\textcolor{rgb:red!50,4;green!25,2}{Another extended color expression (rgb:red!50,4;green!25,2)}.

\bigskip

\begingroup
\color{black}
Test with named colors:\par
\color{blue}
Test: \textcolor[named]{JungleGreen}{JungleGreen};
Test: \textcolor{JungleGreen}{JungleGreen};
Test: \textcolor{JungleGreen!50!DarkOrchid}{JungleGreen!50!DarkOrchid};
Test: \textcolor{green!50!red}{green!50!red}.
\endgroup

\bigskip

{\color[rgb]{.4,.5,.6}Test with \texttt{\string\color}}

\bigskip
Current color application:\par
\def\test{current, \textcolor{.!50}{50\%}, \textcolor{-.}{complement},
          \textcolor{yellow!50!.}{mix}}
\textcolor{blue}{\test} and \textcolor{red}{\test},\par
\def\Test{\color{.!80}Test}
\textcolor{blue}{\Test\Test\Test\Test\Test} and
\textcolor{red}{\Test\Test\Test\Test\Test}.

\bigskip
Current color test with \texttt{\string\definecolorseries}:\par
\begingroup
\color{blue}
\definecolorseries{foo}{rgb}{last}{.}{-.}
\resetcolorseries[5]{foo}
\def\test{\hbox to 1em{{\color{foo!!+}\vrule width 1em height 1.5ex}}}
Test\test\test\test\test\test\test Test

\resetcolorseries[5]{foo}
\def\test{\hbox to 1em{{\color{foo!!++}\vrule width 1em height 1.5ex}}}
Test\test\test\test\test\test\test Test

\resetcolorseries[5]{foo}
\def\test{\hbox to 1em{{\color{foo!![2]}\vrule width 1em height 1.5ex}}}
Test\test\test\test\test\test\test Test

\endgroup

\section{Color in tables}

\rowcolors[\hline]{1}{green!25}{yellow!50}
\begin{tabular}{ll}
test & row \number\rownum\\
test & row \number\rownum\\
\rowcolor{blue!25}
test & row \number\rownum\\
test & row \number\rownum\\
\hiderowcolors
test & row \number\rownum\\
test & row \number\rownum\\
\showrowcolors
test & row \number\rownum\\
test & row \number\rownum\\
\multicolumn{1}%
 {>{\columncolor{red!12}}l}{test} & row \number\rownum\\
\end{tabular}

\section{Color information}

Type test:
\makeatletter
\@namedef{\string\color@foo1}{foo1{}{}{}{}}\edef\tempa{\XC@type{foo1}}\tempa
\@namedef{\string\color@foo2}{\xcolor@{foo2}{}{}{}}\edef\tempb{\XC@type{foo2}}\tempb
\@namedef{\string\color@foo3}{\xcolor@{}{foo3}{}{}}\edef\tempc{\XC@type{foo3}}\tempc
\@namedef{\string\color@foo4}{\xcolor@{}{}{foo4}{}}\edef\tempd{\XC@type{foo4}}\tempd
\makeatother

\end{document}
%</test3>
%
%<*test4>
\listfiles
\documentclass[a4paper]{article}
%%\PassOptionsToPackage{dvipdf}{xcolor}
%%\PassOptionsToPackage{dvipdfm}{xcolor}
%%\PassOptionsToPackage{dvipdfmx}{xcolor}
%%\PassOptionsToPackage{dvips}{xcolor}
%%\PassOptionsToPackage{dvipsone}{xcolor}
%%\PassOptionsToPackage{dviwin}{xcolor}
%%\PassOptionsToPackage{dviwindo}{xcolor}
%%\PassOptionsToPackage{emtex}{xcolor}
%%\PassOptionsToPackage{oztex}{xcolor}
%%\PassOptionsToPackage{luatex}{xcolor}
%%\PassOptionsToPackage{pctex32}{xcolor}
%%\PassOptionsToPackage{pctexhp}{xcolor}
%%\PassOptionsToPackage{pctexps}{xcolor}
%%\PassOptionsToPackage{pctexwin}{xcolor}
%%\PassOptionsToPackage{pdftex}{xcolor}
%%\PassOptionsToPackage{tcidvi}{xcolor}
%%\PassOptionsToPackage{textures}{xcolor}
%%\PassOptionsToPackage{truetex}{xcolor}
%%\PassOptionsToPackage{vtex}{xcolor}
%%\PassOptionsToPackage{xdvi}{xcolor}
%%\PassOptionsToPackage{xetex}{xcolor}
%%\PassOptionsToPackage{prologue}{xcolor}
%%\PassOptionsToPackage{kernelfbox}{xcolor}
%%\PassOptionsToPackage{xcdraw}{xcolor}
\usepackage[emtex]{graphics}
\usepackage{xcolor}
\usepackage[margin=1.25cm,noheadfoot]{geometry}
\pagestyle{empty}
\parindent0pt
\nofiles
\let\familydefault\sfdefault
\makeatletter
%% special code for driver list construction via
%%   latex \def\xcdriverlist{1}\input{xcolor4}
%% writes list in file xcolor4.tmp
\@ifundefined{xcdriverlist}{}{%
%% optional * (skips test whether #1.def exists)
%% #1 = driver
%% #2 = additional options (stored in \options@#2)
%% #3 = processor 1
%% #4 = output format 1
%% #5 = processor 2
%% #6 = output format 2
%% #7 = processor 3
%% #8 = output format 3
\def\0{\@ifstar
  {\def\@@tmp####1{\@firstoftwo}\1}{\def\@@tmp####1{\IfFileExists{####1.def}}\1}}
\def\1#1#2#3#4#5#6#7#8{\@@tmp{#1}%
  {\XC@let@Nc\@@tmp{options@#2}
   \ifx\@@tmp\@empty\else
     \edef\@@tmp{,\@@tmp}\XC@replace\@@tmp,{;#1-}\XC@replace\@@tmp;,
   \fi
   \edef\@@tmp{:=#1\@@tmp}
   \expandafter\@for\expandafter\@tempa\@@tmp\do
    {\let\@@tmp\@tempa\XC@replace\@@tmp-,
     \edef\@@tmp{\@tempa\space\string\PassOptionsToPackage{\@@tmp}{xcolor}}
     \@namexdef{list@#4}{\@nameuse{list@#4},#3 \@@tmp}
     \@namexdef{list@#6}{\@nameuse{list@#6},#5 \@@tmp}
     \@namexdef{list@#8}{\@nameuse{list@#8},#7 \@@tmp}}}%
  {\typeout{No file `#1.def' found.}}}
\def\list@{}
\def\list@dvi{}
\def\list@ps{}
\def\list@pdf{}
\@namedef{options@0}{}
\@namedef{options@1}{kernelfbox,prologue,xcdraw,kernelfbox-xcdraw,prologue-xcdraw}
\0{dvips}1{latex}{dvi}{dvips}{ps}{ps2pdf}{pdf}
\0{pctex32}0{latex}{dvi}{dvips}{ps}{ps2pdf}{pdf}
\0{dvipdf}0{latex}{dvi}{dvipdf}{pdf}{}{}
\0{dvipdfm}1{latex}{dvi}{dvipdfm}{pdf}{}{}
\0{dvipdfmx}0{latex}{dvi}{dvipdfmx}{pdf}{}{}
\0{dvipsone}0{latex}{dvi}{}{}{}{}
\0{dviwin}0{latex}{dvi}{}{}{}{}
\0*{dviwindo}0{latex}{dvi}{}{}{}{}
\0{emtex}0{latex}{dvi}{}{}{}{}
\0*{oztex}0{latex}{dvi}{}{}{}{}
\0{pctexhp}0{latex}{dvi}{}{}{}{}
\0{pctexps}0{latex}{dvi}{}{}{}{}
\0{pctexwin}0{latex}{dvi}{}{}{}{}
\0{tcidvi}0{latex}{dvi}{}{}{}{}
\0{textures}0{latex}{dvi}{}{}{}{}
\0{truetex}0{latex}{dvi}{}{}{}{}
\0*{xdvi}0{latex}{dvi}{}{}{}{}
\0{pdftex}1{pdflatex}{pdf}{}{}{}{}
\0{vtex}0{vlatex}{pdf}{}{}{}{}
\0{xetex}0{xelatex}{pdf}{}{}{}{}
\newwrite\@tempa\immediate\openout\@tempa=\jobname.tmp
\@tfor\@tempb:={dvi}{ps}{pdf}\do
 {\edef\@@tmp{\@nameuse{list@\@tempb}}\edef\@@tmp{:=\expandafter\@gobble\@@tmp}
  \expandafter\@for\expandafter\@@tmp\@@tmp\do
   {\immediate\write\@tempa{\@@tmp}}}
\immediate\closeout\@tempa
\@@end}% end of driver list construction code
\edef\Options{\expandafter\@gobble\XC@@opt}
\@tfor\@@tmp:={dvipdf}{dvipdfm}{dvipdfmx}{dvips}{dvipsone}{dviwin}{dviwindo}%
              {emtex}{oztex}{pctex32}{pctexhp}{pctexps}{pctexwin}{pdftex}%
              {tcidvi}{textures}{truetex}{vtex}{xdvi}{xetex}%
              {natural}{table}{fixpdftex}{hyperref}{showerrors}{hideerrors}%
              {override}{usenames}{nodvipsnames}{debugshow}\do
 {\expandafter\XC@replace\expandafter\Options\expandafter{\@@tmp,}{}}
\edef\Options{\XC@@drv,\Options}
\def\@@tmp#1,#2%
 {\ifx,#2#1\expandafter\remove@to@nnil\else#1', `\expandafter\@@tmp\fi#2}
\edef\Options{`\expandafter\@@tmp\Options,,\@nnil'}
\makeatother
\begin{document}
\vbox to\textheight{\vss\centering
{\Large\textbf{xcolor} driver test: \Options}
\vskip0.5cm
\begin{testcolors}[rgb,hsb,cmyk,gray,HTML]
\testcolor{magenta}
\testcolor[rgb]{1,0,1}
\testcolor[hsb]{0.83333,1,1}
\testcolor[cmyk]{0,1,0,0}
\testcolor[gray]{0.41}
\noalign{\medskip}
\testcolor{blue}
\testcolor[rgb]{0,0,1}
\testcolor[hsb]{0.66667,1,1}
\testcolor[cmyk]{1,1,0,0}
\testcolor[gray]{0.11}
\noalign{\medskip}
\testcolor{cyan}
\testcolor[rgb]{0,1,1}
\testcolor[hsb]{0.5,1,1}
\testcolor[cmyk]{1,0,0,0}
\testcolor[gray]{0.7}
\noalign{\medskip}
\testcolor{green}
\testcolor[rgb]{0,1,0}
\testcolor[hsb]{0.33333,1,1}
\testcolor[cmyk]{1,0,1,0}
\testcolor[gray]{0.59}
\noalign{\medskip}
\testcolor{yellow}
\testcolor[rgb]{1,1,0}
\testcolor[hsb]{0.16667,1,1}
\testcolor[cmyk]{0,0,1,0}
\testcolor[gray]{0.89}
\noalign{\medskip}
\testcolor{red}
\testcolor[rgb]{1,0,0}
\testcolor[hsb]{0,1,1}
\testcolor[cmyk]{0,1,1,0}
\testcolor[gray]{0.3}
\noalign{\medskip}
\testcolor{black}
\testcolor[rgb]{0,0,0}
\testcolor[hsb]{0,0,0}
\testcolor[cmyk]{0,0,0,1}
\testcolor[gray]{0}
\noalign{\medskip}
\testcolor{gray}
\testcolor[rgb]{0.5,0.5,0.5}
\testcolor[hsb]{0,0,0.5}
\testcolor[cmyk]{0,0,0,0.5}
\testcolor[gray]{0.5}
\noalign{\medskip}
\testcolor{white}
\testcolor[rgb]{1,1,1}
\testcolor[hsb]{0,0,1}
\testcolor[cmyk]{0,0,0,0}
\testcolor[gray]{1}
\noalign{\medskip\smallskip}
f(color)box &
\multicolumn5{c}{\def\i{\fbox{\a}}\def\ii{\fcolorbox{red}{yellow}{\a}}\def\iii{\scalebox{3}}%
\def\a{{\setbox0=\hbox to3ex{\hss\textcolor{blue}{\vrule width .75ex height1.5ex depth1.5ex}\hss}\ht0=0pt\dp0=0pt\box0}}%
\fboxsep0.333ex \i\quad\ii\quad\iii\i\quad\iii\ii\quad\fboxrule.75ex \iii\i\quad\iii\ii}
\end{testcolors}
\vskip0.5cm
{\footnotesize This table was generated with \textbf{xcolor4.tex} which is part of the \textbf{xcolor} package \XCfileversion{} (\XCfiledate) by Uwe Kern.}
\vss}
\end{document}
%</test4>
%
% \fi
\endinput
%%
%% End of file `xcolor.dtx'.